public final static WeekDay SUN = new WeekDay();
public final static WeekDay MON = new WeekDay();
public WeekDay nextDay()
{
if(this==SUN)
return MON;
else
return SUN;
}
public String toString()
{
return this==SUN?"SUM":"MON";
}
}
错误类型
java.lang.SecurityException: Prohibited package name: java
at java.lang.ClassLoader.preDefineClass(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Exception in thread "main" 作者: 李楠 时间: 2011-12-25 10:41
看不到错误,我试着运行了一下,无误,控制台返回SUM;
你看看你不是点到别的工程或者类上了。作者: 黑马张伟 时间: 2011-12-25 10:50
运行时出现 could not find the main class :java.EnumTest.Program will exit作者: 王冀 时间: 2011-12-25 10:51
package java;
为什么要写这一句?作者: 黑马张伟 时间: 2011-12-25 10:52
包名,文件在这个里面作者: 黑马张伟 时间: 2011-12-25 10:53
好纠结啊,出来了原来是包名有问题,谢谢楼上了