How to Create a Static Member Class in Java


In this example we will show how to use static member class in Java.

Source Code

package com.beginner.examples;

public class StaticMemberClassExample {
	 
    public static class A{
        public void test(){
            System.out.println("It is a memeber class.");
        }
    }
     
    public static void main(String[] args){ 
    	// directly call the innner class
        A a = new StaticMemberClassExample.A();
        a.test();
    }
}

Output:

It is a memeber class.
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments