Pages

Saturday 16 November 2013

What are the differences between public and private access modifier in java




Public access modifier  
Private access modifier

It is uses the public keyword in java .

It uses the private keyword in java.

Member defined using public is visible ANYWHERE.

Member defined using private is only visible to that class only

Public can be used with class.

Private cannot be used with the class

We can make an interface as public.

We cannot make an interface as private.

No comments:

Post a Comment