When I declared a variable like public int n the compiler is showing an error stating that it is the illegal start of an expression. Why is that. I am using JDK 1.8. Please help
I'm guessing youre putting the public int in a method? like the main method? If so, there's the problem. A method, including the main method, can only accept local variables. No public identifier. Can remove the public, or place it outside the main method/other methods.
Thanks. It worked
when you do public int make sure int is in ( )