Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class OuterClass{
- static class InnerStaticClass{
- // static method
- static void display(){
- System.out.println("I'm staic method");
- }
- // non static method
- static void show(){
- System.out.println("I'm non staic method");
- }
- }
- }
- class Main{
- public static void main(String[] args){
- OuterClass.InnerStaticClass obj = new OuterClass.InnerStaticClass();
- // calling non static method
- obj.show();
- // calling staticc method
- OuterClass.InnerStaticClass.display();
- }
- }
- // output
- I'm non staic method
- I'm staic method
Add Comment
Please, Sign In to add comment