Two classes cannot be put in a .java file
2011-10-01 19:19
393 查看
Twoclassescannotbeputin
a.java file.
Forexample
:
publicclassFinalTest
{
String
color="yellow";
publicvoidgetMes()
{
System.out.println("parent
class variable of color: "+color);
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
publicclasstest
extendsFinalTest
{
String color="blue";
publicvoidgetMes()
{
System.out.println("child class variable of color: "+color);
}
public
staticvoidmain (String[] args)
{
test t=newtest();
t.getMes();
}
}
Thought it's a simply programming ,it took me nearly half an hour to check out where goes wrong.---I put them in a same .java file ,and hadn't create a test.java in the package folder.
PS:A function which is the type of final cannot be rewrite in its child class .
a.java file.
Forexample
:
publicclassFinalTest
{
String
color="yellow";
publicvoidgetMes()
{
System.out.println("parent
class variable of color: "+color);
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
publicclasstest
extendsFinalTest
{
String color="blue";
publicvoidgetMes()
{
System.out.println("child class variable of color: "+color);
}
public
staticvoidmain (String[] args)
{
test t=newtest();
t.getMes();
}
}
Thought it's a simply programming ,it took me nearly half an hour to check out where goes wrong.---I put them in a same .java file ,and hadn't create a test.java in the package folder.
PS:A function which is the type of final cannot be rewrite in its child class .
相关文章推荐
- The absolute uri: http://java.sun.com/jstl/core cannot be resolved in either web.xml or the jar file
- java.io.FileNotFoundException: class path resource [WEB-INF/classes/cn/golaxy/yqpt/pojo/] cannot be resolved to URL because it
- java.io.FileNotFoundException: URL [jndi:/localhost/myBlogSys/WEB-INF/classes/] cannot be resolved t
- The absolute uri: http://java.sun.com/jstl/core cannot be resolved in either web.xml or the jar file
- java.io.FileNotFoundException: class path resource [META-INF/xfire/services.xml] cannot be opened because it does not exist
- The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar
- JAVA中 错误代码是 the public type must be defined in its own file 解决方法 android开发 java编程
- HTTP Status 500 - The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either w
- Archive for required library: "xxxx" in project '*' cannot be read or is not a valid ZIP file
- warning C4819: The file contains a character that cannot be represented in the current code page
- [SSM/Junit]java.io.FileNotFoundException: class path resource [spring-mybatis.xml] cannot be opened
- java.lang.String cannot be resolved, Indirectly referenced from required .class file
- Hi there,Error:The absolute uri: http://java.sun.com/jsp/jstl/sql cannot be resolved in either web.xml or the jar files deployed
- java.io.fileinputstream cannot be cast to java.io.file
- cannot be resolved to absolute file path because it does not reside in the file system
- The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar
- warning C4819: The file contains a character that cannot be represented in the current code page
- warning C4819 解决方案 warning C4819: The file contains a character that cannot be represented in the cu
- 报错:jstl标签——The absolute uri: http://java.sun.com/jsp/jstl/core cannot beresolved in either web.xml o
- 解决使用maven的java web项目导入后出现的有关问题, -cannot be read or is not a valid zip file