java4all@1986 java. Powered by Blogger.

Difference between public,protected,private,default?

>> Monday, May 30, 2011

public(Modifier): It is used in  Outer classes, interfaces,
constructors, Inner classes, methods
and field variables.
Description:A class or interface may be accessed from outside the
package. Constructors, inner classes, methods and field
variables may be accessed wherever their class is
accessed.

protected:Constructors, inner classes, methods,
and field variables.
Description:Accessed by other classes in the same package or any
subclasses of the class in which they are referred (i.e. same
package or different package).

private:Constructors, inner classes,
methods and field variables,
Description:Accessed only within the class in which they are declared

<Default>:Outer classes, inner classes,
interfaces, constructors, methods, and
field variables
Description:Accessed only from within the package in which they are
declared.

0 comments:

Post a Comment

FaceBook Login

HTML/JAVASCRIPT

HTML/JAVASCRIPT

HTML/JAVASCRIPT

HTML/JAVASCRIPT

Total Pageviews

STATCOUNTER

  © Blogger template Simple n' Sweet by Ourblogtemplates.com 2009

Back to TOP