Computer Science, asked by gvaibhav797, 1 year ago

What is meant by private visibility of a method?

Answers

Answered by Anonymous
6
A main method has special connotations in Java, yet it's still a method belonging to a particular class.

Private fields in the enclosing class are accessible to the main method, either through a local instance (in the case of instance fields) or directly (in the case of static fields).

Answered by Anonymous
6

Explanation:

Private access modifier simply means that the variable on which it is used will be accessible only in the enclosing class. Period. Since your main() method is in ToSee class which is where you have the hiddenInt private instance variable, it is visible.

Similar questions