内部类

内部类的调用方式。

Net.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package com.gxun.bigdata.study.net;

public class {

public class SubNet{

public void subNetTest(){
System.out.println("SubNetTest");
}

}

public static class SubNetStatic{

public void subNetStaticTest(){
System.out.println("subNetStaticTest");
}

}

}

TestNet.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package com.gxnu.bigdata.study.net.test;

import org.junit.Test;

import com.gxun.bigdata.study.net.Net;
import com.gxun.bigdata.study.net.Net.SubNet;
import com.gxun.bigdata.study.net.Net.SubNetStatic;;

public class TestNet {


public void test(){
Net net = new Net();
Net.SubNet nn = net.new SubNet();
nn.subNetTest();

SubNet ss = net.new SubNet();
ss.subNetTest();

SubNetStatic st = new SubNetStatic();
st.subNetStaticTest();
}
}

limaodeng

scribble