It so happens that my compiler is telling me there is something wrong with the 2 bottom statements of this do-while loop, just above the while-part.
My ideas for solving this are to either eliminate the statements or just know what is wrong with the statements themselves by recognizing their nature, but I somehow can't find what each nature is.
Here are their relevant error-messages:
ReadNEditFile.java:67: error: not a statement
String continue = keys.nextLine();
^
ReadNEditFile.java:67: error: ';' expected
String continue = keys.nextLine();
^
ReadNEditFile.java:67: error: ';' expected
String continue = keys.nextLine();
^
ReadNEditFile.java:68: error: illegal start of expression
char editOrNot = continue.charAt(0);
^
ReadNEditFile.java:68: error: illegal start of expression
char editOrNot = continue.charAt(0);
^
ReadNEditFile.java:68: error: ';' expected
char editOrNot = continue.charAt(0);
^
6 errors
This thread also comes with the problematic-code:
do { // Get the entry-number that the user wants to edit. System.out.println("What is the number you want to add onto the account list"); System.out.println("starting with account-0?"); userNum = keys.nextInt(); // Now find it to show it to the user. byteNum = ENTRY_SIZE * userNum; readNEdit.seek(byteNum); numFound = readNEdit.readDouble(); System.out.println(numFound); // Now replace the entry with the user's new-number. System.out.println(); System.out.println("What do you want to write over this entry?"); newNum = keys.nextDouble(); readNEdit.seek(byteNum); readNEdit.writeDouble(newNum); // Ask the user if he/she wants to continue this. System.out.println("Do you want to continue editing?"); String continue = keys.nextLine(); char editOrNot = continue.charAt(0); }while (editOrNot == 'y');
How do I correct this if the compiler seems to point out errors that aren't there?