Posts

Showing posts with the label declare default private protected and public

Access Control in Java

How a member can be accessed is determine by the access specifier that modifies its declaration. Java's Access Specifiers are public private protected default If no access specifies is used then by default the member of a class is public within its own package but cannot be accessed outside of its package. Some difference Between Access Control: 1.Public: The public Access specifies are  visible in full project or code. Declaration:                                public int a; 2. Private:                  The private Access specifies are  visible only in class you can not access these specifies outside the class or method if declare in method. Declaration:                             private int a; 3.Protected:     ...