frame

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Register

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Who's Online 0

Don't Hesitate for ask Question, post your assignment with hope you will find best solution.

What are the various access specifiers in Java?

ansaraliansarali Posts: 21,481

In Java, access specifiers are the keywords which are used to define the access scope of the method, class, or a variable. In Java, there are four access specifiers given below.

  • Public The classes, methods, or variables which are defined as public, can be accessed by any class or method.
  • Protected Protected can be accessed by the class of the same package, or by the sub-class of this class, or within the same class.
  • Default Default are accessible within the package only. By default, all the classes, methods, and variables are of default scope.
  • Private The private class, methods, or variables defined as private can be accessed within the class only.


Sign In or Register to comment.

VULMS Virtual University of Pakistan

|Virtual University of Pakistan

Contact us

admin@va.com.pk
support@va.com,pk
(+92347) 4008815

Get In Touch