I can't figure out why I get this error.
Here is the code:
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();
Here is the error:
test.java:78: error: incompatible types
return stringBuilder.toString();
^
required: int
found: String
1 error
What can I do to fix this?
void, ie. nothing. You can't return anything as it stands.int, edited it now, i get this error when its writtenintand notvoid.