心心提问,请求帮助,
xxrei 2004-08-09 01:56:40 问题一:
public class ATypeNameTest{
class ATypeName{
int b;
b = 23;
}
public static void main(String args[]){
ATypeName a = new ATypeName();
System.out.println("aa");
}
}
为何执行以上代码时会出下列提示:
---------- javac ----------
E:\javatest\01\HelloDate\exercise\ATypeNameTest\ATypeNameTest.java:4: <identifier> expected
b = 23;
^
1 error
Output completed (1 sec consumed) - Normal Termination
————————————————————————————————
问题二:
public class ATypeNameTest{
void ATypeName(){
int b;
b = 23;
}
public static void main(String args[]){
ATypeName a = new ATypeName();
System.out.println("aa");
}
}
执行如上代码后出现如下提示
---------- javac ----------
E:\javatest\01\HelloDate\exercise\ATypeNameTest\ATypeNameTest.java:8: cannot resolve symbol
symbol : class ATypeName
location: class ATypeNameTest
ATypeName a = new ATypeName();
^
E:\javatest\01\HelloDate\exercise\ATypeNameTest\ATypeNameTest.java:8: cannot resolve symbol
symbol : class ATypeName
location: class ATypeNameTest
ATypeName a = new ATypeName();
^
2 errors
Output completed (9 sec consumed) - Normal Termination