Java类和包
大家好,我是Java的初学者。在这一点上,我被以下内容所阻碍 节目: 这给了我一个错误:Java类和包,java,Java,大家好,我是Java的初学者。在这一点上,我被以下内容所阻碍 节目: 这给了我一个错误: bad class file: ./prog/io/Orario.class class file contains wrong class: prog.utili.Orario Please remove or make sure it appears in the correct subdirectory of the classpath. 在那些日子里,我做了我能做的一切,但都没用。上课在这儿 奥
bad class file: ./prog/io/Orario.class
class file contains wrong class: prog.utili.Orario
Please remove or make sure it appears in the correct subdirectory of the classpath.
在那些日子里,我做了我能做的一切,但都没用。上课在这儿
奥拉里奥:
感谢您提供的任何建议在java中,目录与包名相同。
因此,包prog.utili中的类Orario
必须位于目录prog/utili而不是prog/io中您的类
Orario
具有错误的包声明(package prog.utili;
而不是package prog.io;
)
prog.io.Orario
prog/io
中的文件Orario.class
中搜索classOrario
prog.utili
,这不是所需的包-错误请查阅Java基础知识中的软件包。我建议您使用诸如eclipse()、intellJ()或netbeans()之类的IDE进行编码。对于初学者来说,包可能是一个真正的噩梦。请参阅Elliotte Rusty Harold关于developerWorks的指南以获得介绍。除了其他人所说的关于包的内容之外,作为评论,我建议您使用英语标识符来表示变量、类等。。。而不是意大利语,否则你最终会发现寻求帮助有困难(你的变量不能告诉你它们是什么)。我不能使用eclipse,因为我正在阅读一本只使用linux终端的书。是的,我想读一些关于包裹的东西!好的,下次我会换成英语。你是意大利人吗?
bad class file: ./prog/io/Orario.class
class file contains wrong class: prog.utili.Orario
Please remove or make sure it appears in the correct subdirectory of the classpath.
package prog.utili;
public class Orario {
private static char separaratore=';';
}