Java Error - java: class, interface, or enum expected -
would able advise me on causing java error in basic program trying write?
the error received says: error:(27, 1) java: class, interface, or enum expected
here code below package name.
import java.util.scanner; public class main { public static void main(string[] args) { scanner kbd = new scanner(system.in); string s = ""; boolean isok = true; while (isok) { system.out.print("key in numeric string (enter minus sign - quit): "); s = kbd.nextline(); char c = s.charat(0); if (c == '-') { isok = false; system.out.print("you have quit program."); return; } } } } }
you have closing brace
remove last '}'
.
i tested code manually, simple, works fine.
Comments
Post a Comment