Java Default Class

Java Default Class


Default Class In Java
 
Now we will understand what is default class in simple words 
When we do not use any keyword explicitly with the class.
The Java will set default access to a given class, method, or property which we call as default class.
Hence if we do not set default access as public it will not be accessible from other packages.
Now we will see examples - 
 
Example - 
 
 
Now trying to access this in another package - 
 
 
Output -