June 2018
Beginner
722 pages
18h 47m
English
There are three explicit access modifiers—public, private, and protected—and one implicit (default) access modifier that is implied when no access modifier is set. They can be applied to the top-level class or interface, their members, and constructors. A top-level class or interface can include a member class or interface. Other members of a class or interface are fields and methods. Classes also have constructors.
To demonstrate the accessibility, let's create a com.packt.javapath.Ch07demo.pack01 package that contains two classes and two interfaces:
public class PublicClass01 { public static void main(String[] args){ //We will write code here }}class DefaultAccessClass01 {}public interface PublicInterface01 { String name ...
Read now
Unlock full access