我不知道为什么我会收到这个错误。
这是代码:
public static int WriteBirdType() {
BufferedReader reader = new BufferedReader( new FileReader ("fugler.txt"));
String line = null;
StringBuilder stringBuilder = new StringBuilder();
String ls = System.getProperty("line.separator");
while( ( line = reader.readLine() ) != null ) {
stringBuilder.append( line );
stringBuilder.append( ls );
}
return stringBuilder.toString();
这是错误:
test.java:78: error: incompatible types
return stringBuilder.toString();
^
required: int
found: String
1 error
我能做些什么来解决这个问题?