0
What are all the Java modifiers?? And how it works??
3 Answers
+ 4
These are the main ones you'll need to know:
public - all classes can access this.
private - only this class can access this.
protected - this, child classes, and package members can access this.
then one other is
package private - only package members have access. This is the default access for a class.
+ 3
default: Variable/method can only be accessed by the class it's in, and the classes in the same package.
public: Variable/method is visible to all classes outside the one it's declared in.
private: Variable/method is only visible to the methods inside the class it's in.
protected: Variable/method is accessible to the class it's in, all classes in the same package, and all subclasses.
+ 1
Thanku for ur answers