What are the various access specifiers in Java?

379 views 1 replies

I am confused about these access specifiers so please explain .

Replies (1)
It has four specifier
public
private
protected
default or say no specifier


public .these specifier archives highest level of accessibility , classes, method or fields declared as public
they can assessed any class in java program
in own or same package or in another package

private- these specifier achives lowest level of accessibility
private method and fields can be assessed with same classes to which the method or field belongs
they are not visible to subclasses and not inhireted bysub classes

protected- here methods and fields are declared as protected and can only assessed by sub classes in other packages or with in the same package of the protected members class
they can't applied to class and interfaces

default - when you don't set access specifier element it follows default accessibility level
here we can access method class field belongs to same package not the outsiders package

Leave a Reply

Your are not logged in . Please login to post replies

Click here to Login / Register  

Company
22 June 2026
Finance Manager- Chartered Accountant

Triveni Turbine Limited

Bengaluru

CA

View Details
Company
Featured 18 July 2026
CA Articleship

apricus india

Mumbai

CA Inter

View Details
Company
ARTICLESHIP 16 July 2026
Article Assistant

Sahil Agarwal & Company

Mumbai

CA Inter

View Details
Company
05 July 2026
Financial Controller

NovumLake Partners

Mumbai

CA

View Details
Company
ARTICLESHIP 27 June 2026
CA Articled Trainee And Paid Assistant

SKAA & Associates

New Delhi

CA Inter

View Details
Company
06 July 2026
Senior Accountant

Arvindkumar Maniar & Co.

Rajkot

CA

View Details
Company
ARTICLESHIP 30 June 2026
Taxation Content Writer Intern

Interactive Media Pvt Ltd.

New Delhi

CA Inter

View Details
Company
ARTICLESHIP 24 June 2026
ARTICLE ASSISTANT

BHUPINDER SHAH AND COMPANY

New Delhi

CA Inter

View Details