Access Modifiers in java
Some important
conclusion:-
The modifiers which are
applicable for inner classes but not for
outer class.
1. private
2. protected
3. static
The modifiers which are
applicable for classes but not for interface are final.
The modifiers which are
applicable for classes but not for enums are final and abstract.
The modifiers which are applicable
only for methods and which we cannot used anywhere else native.
The modifiers which are applicable
for constructors are:-
1. private
2. protected
3. public
4. default
The only applicable modifier for
local variable is final.
The interface which is declared
inside a class is always static whether we are declaring or not.
The interface which is declared
inside a interface is always public and static whether we are declaring or not.
The class which is declared
inside a interface is always public and static whether we are declaring or not.
Case:-1 class inside class
class A
{
class B
{
}
}
Case:-2 class inside interface
class A
{
interface B//by
default static
{
}
}
Case:-3 interface inside
interface
interface A
{
interface B//by
default public and static
{
}
}
Case:-4 interface inside
class
interface A
{
class B//by default
public and static
{
}
}
No comments:
Post a Comment