Static inner classes
In general in java classes it is not possible to declare any class as a abstract class but is possible to declare inner class as a static modifier.
Declaring the static class inside the another class is called static inner class.
Static inner classes can access only static variables and static methods it does not access the instace variables and instance methods.
Syntax :
class Outer
{
static class Inner
{
};
};
Static inner classes program
class Test 
{ 
static int a=10; 
static int b=20; 
static class Inner 
{ 
int c=30; 
void m1() 
{ 
System.out.println(a); 
System.out.println(b); 
System.out.println(c); 
} 
}; 
public static void main(String[] args) 
{ 
Test o=new Test(); 
Test.Inner i=new Test.Inner(); 
i.m1(); 
} 
};
Output :
10
20
30

We see you’re using an ad blocker.

Our website is made possible by displaying ads to our visitors.

Please help us continue to provide you with free. So please disabling your ad blocker.