Reputation: 41
For an application program, I'm attempting to initialize an int variable to 3_745_000. However, at any point I try to compile, I am given the ';' expected error at the first underscore used, and the identifier expected error at the actual semi colon. As far as I know, this is an entirely legal use of an underscore in Java, so I don't understand why I'm receiving the error. This is the code.
private static int lastacct = 3_745_000;
I am given the same error no matter where I try to put the underscore.
Upvotes: 4
Views: 279
Reputation: 5714
Make sure the variable you made is an instance variable,make sure it is not placed inside any of your methods,just inside the class.
Upvotes: 1