Difference between protected and default access - Java

Difference between protected and default access

The default access specifier is one which is not specified with a key word. If no access specifier (any one of private, protected, public) is mentioned it is known as the default access specifier. The methods, variables of class without access specifier can be accessed by classes, methods within the package in which they were declared.

The protected access specifier also has the same scope that of default access specifier and can be accessed in all subclasses of the protected class across packages i.e., packages other than the package in which the protected member is declared / defined.
Ways that the members of a package can be used by other packages - Java
There are two ways of affecting access levels. One, when the classes in the Java platform are used within the developer defined classes, the access levels determine the members of those class which can be used by the developer defined classes...
Explain Java’s delegation event model - Java
The event model is based on the Event Source and Event Listeners. Event Listener is an object that receives the messages / events. The Event Source is any object which creates the message / event...
Describe the assert keyword - Java
The programmer assumes certain code while developing when handling exceptions. For example, a number is passed as parameter to a method and it is to be validated whether it is positive...
Post your comment
Discussion Board
diffrence between server and client
server is a destination side activity where as client is a source side activity
Rajesh Rawat 01-18-2014
Abbout Access Modifires
I think
public ---Any Place
Protected----Same Package SubClass
default ---Any Package But we want to import that Packge name
Private------Same Class Only
keshav 06-1-2012