内部类的使用示例
package test;
/**
?* 一个类与某个类结合的很紧密,并且内部类的类名不会被其它类可见和调用,也不会产生命名冲突==
?*
?*/
public class InneryClass {
?private int tt;
?
?public InneryClass(int tt){
??Square s = new Square(tt);
??this.tt = s.t;
?}
?
?class Square {
??public int t;
??public Square(int t){
???this.t = t*t;
??}
?}
?
?public static void main(String[] args) {
??InneryClass s = new InneryClass(5);
??System.out.println(s.tt);
?}
}