banner_ad

What are the various access specifiers in Java?

Softwares 339 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


CCI Pro

Leave a Reply

Your are not logged in . Please login to post replies

Click here to Login / Register  

Company
03 May 2026
Senior Chartered Accountant

Nirmal Jain & Co

New Delhi

CA

View Details
Company
ARTICLESHIP 27 May 2026
CA Article Trainee

Rahul Dang & Associates-Chartered Accountants

Pune

CA Inter

View Details
Company
27 May 2026
Audit Assitant

Virender K Gupta and Co

New Delhi

B.Com

View Details
Company
ARTICLESHIP 17 May 2026
CA Article /Trainee

Malik Sunil & co

New Delhi

CA Foundation

View Details
Company
11 May 2026
Post office

Post office

Anakapalle

Others

View Details
Company
ARTICLESHIP 15 May 2026
ARTICLE ASSISTANT, TRAINEE AND PAID ASSISTANT

YOGESH KAPOOR AND ASSOCIATES

New Delhi

B.Com

View Details
Company
24 May 2026
Accounts & Tax Executive

PARAS KHURANA AND CO

New Delhi

B.Com

View Details
Company
14 May 2026
Financial Analyst - Remote Finance Expert

HiringBridge

Ahmedabad

CA

View Details