java
tute
learn
.com
Easy Learning
Home
Search Javatutelearn.com :
☰
Introduction
☛ Java Introduction
☛ Java History & Features
☛ Object Oriented Features
☛ What is Bytecode?
☛ Java Data Types
Loop
☛ 'For' loop
☛ 'While' loop
☛ 'Do..While' loop
☛ 'If' statement
Operator
☛ Arithmetic Operator
☛ Logical Operator
☛ Relational Operator
☛ Bitwise Operator
Array
☛ Java Array
☛ Matrix Examples
Class
☛ Java Class
☛ Instance variable versus Local variable
☛ Object Reference Variable
☛ this keyword
☛ Java Constructor
☛ Java Overloaded Constructor
☛ Java Copy Constructor
☛ native method
Inheritance
☛ Java Inheritance
☛ Super Keyword
☛ Java Method Overloading
☛ Java Method Overriding
☛ final method
☛ Java Access Specifier
Package & Interface
☛ Java Package
☛ Java Interface
Static Concept
☛ Java Static variable
☛ Java Static Method
☛ Java Static Block
Exception Handling
☛ Java Exception Handling
☛ Java Throw & Throws
Multithreading
☛ Java Multithreading
☛ Life Cycle of Thread
☛ Thread Scheduler
☛ getName() method
☛ setName() method
☛ getId() method
☛ getState() method
☛ setPriority() method
☛ Daemon Thread
☛ stop() method
☛ isAlive() method
☛ resume() method
☛ suspend() method
☛ join() method
☛ sleep() method
☛ Java Applet
Introduction
☛ Java Introduction
☛ Java History & Features
☛ Object Oriented Features
☛ What is Bytecode?
☛ Java Data Types
Loop
☛ 'For' loop
☛ 'While' loop
☛ 'Do..While' loop
☛ 'If' statement
Operator
☛ Arithmetic Operator
☛ Logical Operator
☛ Relational Operator
☛ Bitwise Operator
Array
☛ Java Array
☛ Matrix Examples
Class
☛ Java Class
☛ Instance variable versus Local variable
☛ Object Reference Variable
☛ this keyword
☛ Java Constructor
☛ Java Overloaded Constructor
☛ Java Copy Constructor
☛ native method
Inheritance
☛ Java Inheritance
☛ Super Keyword
☛ Java Method Overloading
☛ Java Method Overriding
☛ final method
☛ Java Access Specifier
Package & Interface
☛ Java Package
☛ Java Interface
Static Concept
☛ Java Static variable
☛ Java Static Method
☛ Java Static Block
Exception Handling
☛ Java Exception Handling
☛ Java Throw & Throws
Multithreading
☛ Java Multithreading
☛ Life Cycle of Thread
☛ Thread Scheduler
☛ getName() method
☛ setName() method
☛ getId() method
☛ getState() method
☛ setPriority() method
☛ Daemon Thread
☛ stop() method
☛ isAlive() method
☛ resume() method
☛ suspend() method
☛ join() method
☛ sleep() method
☛ Java Applet
‹‹ Previous
Next ››
Java Access Specifier
Java protects access of variables and methods of the class using various protection mechanism.
Protecting access of variables and methods is also called visibility of variables and methods.
There are three types of visibility which are (i) at class level (ii) at package level (iii) at subclass level
There are three types of access specifiers: (i) private (ii) public (iii) protected
Following is description for access specifiers:
Private
access specifier:
It uses the keyword '
private
. '
Members using private access
can not
be accessed by outside the class .
Private members can not be accessed by main() function and by other classes.
Private members can be accessed by only members of the same class.
Public
access specifier:
It uses the keyword '
public
'.
Members using public access
can
be accessed by outside the class.
Public members can be accessed by main() function and by other classes.
Public members can be accessed by anywhere.
Default
access:
If no access specifies keyword is mentioned then it is called
default access
.
Members using default access
can
be accessed within the package only.
Any class outside the package can not access any members which have default access.
‹‹ Previous
Next ››
© Copyright 2016-2024 by javatutelearn.com. All Rights Reserved.