class Point
{
int x,y;
/*Point(int a,int b)
{
x=a;
y=b;
}*/
Point()
{
}
void output()
{
System.out.println(x);
System.out.println(y);
}
public static void main(String[] args)
{
Point pt;
//pt=new Point(3,3);
pt=new Point();
//pt=new Point();
//pt.x=10;
//pt.y=10;
pt.output();
}
执行出来结果应该是
0 0
但是javac后java Point.java结果却是:
E:\java>javac Point.java
E:\java>java Pointt.java.java
Exception in thread "main" java.lang.NoClassDefFoundError: Pointt/java/java
Caused by: java.lang.ClassNotFoundException: Pointt.java.java
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: Pointt.java.java. Program will exit.
请高手指教。。。
------解决方案--------------------------------------------------------
点击开始--运行--输入cmd--输入cd “你的java程序所在的地方”---输入 javac “java文件名”.java---输入java “JAVA文件名”(不加任何后缀名)
------解决方案--------------------------------------------------------
对,就是这样啊。。。怎么不看看错误信息——"NoClassDefFoundError"?