static nested class in Java

A static nested class is a static class defined at the member level. 
A static nested class interacts with the instance members of its outer class and other classes just like any other top-level class. In effect, a static nested class is behaviorally a top-level class that has been nested in another top-level class for packaging convenience.
It can be instantiated without an object of the enclosing class, so it can’t access the instance variables without an explicit object of the enclosing class. 

```
class Main{  
  private int data = 30;  
  public static class Inner{  
   void msg(Main m) { System.out.println("data is " + m.data); }  
  }
  
  public static void main(String args[]){  
    Main.Inner obj = new Main.Inner();  
    obj.msg(new Main());  
  }  
}  
```
Importing a static nested class is interesting. You can import it using a regular import:
```
package bird;
public class Toucan {
   public static class Beak {}
}
package watcher;
import bird.Toucan.Beak;    // regular import ok
public class BirdWatcher {
   Beak beak;
}
```
And since it is static, alternatively you can use a static import:
```
import static bird.Toucan.Beak;
```
Either one will compile. Surprising, isn’t it? Java treats the static nested class as if it were a namespace.