You can not directly access private variables. As for protected and public I will let you test that, switch a to protected then try modifying it directly in main, then compile and run it and see what happens. Try the same thing with public.

Private members of a class cannot be accessed by anybody.
Next level of abstraction is Protected. This means, all the classes derived from the current class can access thr variable as public.
The last level is Public. Anybody can access public members.

Your original example is a bit misleading because your main( ... ) method is defined in that class itself so it has all access rights to any member, even if it is private. For an experiment: define your main( ... ) method in another class and see for yourself.