0% found this document useful (0 votes)
2 views1 page

Java Class Declarations and Access Modifiers

Public classes must be stored in .java files matching the class name. Private variables and methods are only accessible within their own class. Declaring private instance variables hides data from other classes, known as data or information hiding.

Uploaded by

A'del Jumma
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Java Class Declarations and Access Modifiers

Public classes must be stored in .java files matching the class name. Private variables and methods are only accessible within their own class. Declaring private instance variables hides data from other classes, known as data or information hiding.

Uploaded by

A'del Jumma
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

 Each class declaration that begins with keyword public must be

stored in a file having the same name as the class and ending
with the .java file-name extension
 Variables or methods declared with access modifier private are
accessible only to methods of the class in which they’re
declared
 Declaring instance variables with access modifier private is
known as data hiding or information hiding.

You might also like