一个简单JAVA程序 ....?
下面的程序运行有错误 我没找出来 请大虾告诉我是怎么回事?
public class A
{
private int x=3;
public static void main(String[] args)
{
new A().func(new A};
}
public void func(A a)
{
System.out.println(a.x);
}
}
错误提示:
D:\test1\A.java:15: 需要 "(" 或 "["
new A().func(new A};
^
D:\test1\A.java:17: 需要 "class" 或 "interface"
public void func(A a)
^
D:\test1\A.java:21: 需要 "class" 或 "interface"
}
^
D:\test1\A.java:21: 需要 "class" 或 "interface"
}
^
4 错误
Process completed.