Why can't I modify class member variable outside any methods? [duplicate]
This question already has an answer here: Syntax error on token(s) “product1. ”VariableDeclaratorId expected after this token 1 answer syntax error on tokens, variableDeclarator expected instead 3 answers syntax error on addActionListener 3 answers I have an error with system.out.print and I don't know why? [closed] 7 answers Syntax error on token(s), misplaced construct(s) 4 answers I have a class with some variables. When I instantiate an object of that class in the main class. I can only access and modify member variables in a method, any method; not outside them. Why is that? I am stuck