I'd like to know how I could fix the illegal start of expression
error on line 3
1 public class Example {
2 public static void main(String[] args) {
3 private int n;
4 }
5 }
Thanks!
Declarations with scope (i.e. private
, protected
, or public
) must be outside your functions, including the main()
one. Move these declarations to the class level to fix this syntax error.