0% found this document useful (0 votes)
54 views9 pages

Access Specifiers (Modifiers) in Java: Presented by

The document discusses the four types of access specifiers in Java - default, private, protected, and public. It defines what access specifiers are, which are keywords that set the accessibility of classes, methods, and other members. It then provides details on what each access specifier type means in terms of scope - for example, private can only be accessed within its own class, while public has the widest scope and can be accessed anywhere.

Uploaded by

sonali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views9 pages

Access Specifiers (Modifiers) in Java: Presented by

The document discusses the four types of access specifiers in Java - default, private, protected, and public. It defines what access specifiers are, which are keywords that set the accessibility of classes, methods, and other members. It then provides details on what each access specifier type means in terms of scope - for example, private can only be accessed within its own class, while public has the widest scope and can be accessed anywhere.

Uploaded by

sonali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

ACCESS

SPECIFIERS(MODIFIERS)
IN JAVA

PRESENTED BY :
HRITHIK SHINDE
PRAJWAL POOJARI
MANNU VISHWAKARMA
DEFINATION : ACCESS
SPECIFIERS
Access specifiers(or access modifiers) are keywords in
object-oriented languages that sets the accessibility of the
classes , methods and others members
.
THERE ARE 4 TYPES OF JAVA ACCESS SPECIFIERS:

i. DEFAULT
ii. PRIVATE
iii.PROTECTED
iv.PUBLIC
.
1]DEFAULT ACCESS SPECIFIER:
 No keyword is required to specify default
access specifier
 When no access modifier is specified for a
class, method or data member it is said to be
having the default access specifier by default.
 Default access specifier are accessible within
the same package.
2
. ]PRIVATE ACCESS SPECIFIER:
 The private access specifier is specified using the
keyword private.
 The methods or data members declared as private
are accessible only within the class in which they are
declared.
 Any other class of same package will not be able to
access these members.
 Classes or interface can not be declared as private.
3]PROTECTED
. ACCESS
SPECIFIER:
 The protected access specifier is specified
using the keyword protected.
 The methods or data members declared as
protected are accessible within same package
or sub classes in different package.
.4]PUBLIC ACCESS SPECIFIER:
 The public access specifier is specified using the
keyword public.
 The public access specifier has the widest scope
among all other access modifiers.
 Classes, methods or data members which are
declared as public are accessible from every where in
the program. There is no restriction on the scope of
a public data members.
ACCESS LEVELS
Specifier Class Package Subclass Everywhere

Default Y Y N N

Private Y N N N

Protected Y Y Y N

Public Y Y Y Y

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy