Question: java what is the difference between public and private?
Answer: public means you can access it anywhere while private means you can only access it inside its own class. Just to note all private, protected or public modifier are not applicable to local variables in Java. a local variable can only be final in java.