This content has been marked as final. Show 3 replies
it tells me that the package pluto does not exist, and that isn't true it exist in the file Animal.java, someone can explain to me where I'm wrong?
No - that is backwards.
Packages do not exist in class files - class files exist in packages.
Do you have a folder named 'pluto'? Did you put your class file 'Animal.java' in it?
Why isn't your 'Cat' class in a package?
See how to use packages in the Java Tutorial
You will have far fewer problems if you use standard practices and do things the way that most others do them.
1. Create a folder hierarchy that matches your package structure
2. Put ALL class files into an appropriate package and folder
thanks. import doesn't import class but it import files inside a directory (that are class). Cat is not in a pakage just because it was an example, from
That is an example of a class yes, but not of a complete source file. They are commonly referred to as snippets - parts of code. You are supposed to make them complete yourself, which means you need to know what you're doing. Which means you need to study packages and the classpath.