62,625
社区成员
发帖
与我相关
我的任务
分享
import org.junit.Test;
public class Test {
@Test
public void test1() {
final String works = "java";
String talk = "hello world";
PersonIntef pi = new PersonIntef() {
public void say(String msg) {
System.out.println(msg);
}
public void work() {
System.out.println(works);
}
};
pi.work();
pi.say(talk);
talk = "hello java";
pi.say(talk);
}
}
interface PersonIntef {
void say(String msg);
void work();
}
public class InnerTest {
public static void main(String[] args) {
Inner in = new Inner();
System.out.println(in.i);
in.test();
System.out.println(in.i);
}
static class Inner {
int i = 0;
void test() {
i = 1;
}
}
}