Hi I have a question on Java Package. I have created a package with more than one classes [package name is 'animal' and file name is 'Zoo.java']. I have created another java file which is in another package 'mypackage' and created a file called 'MAIN.java'. I tried accessing members of the 'animal' package from 'MAIN.java' and it is throwing me an error because it cannot access classes of 'animal' package. I know that only classes which are in same package should be accessible each other, or it should make as public. But I can only change one class to public in 'Zoo.java'. So I found one solution that create separate java files for each class in animal package and make it as public. Is there any other method ? My understanding was, we can write all classes in one file and import them from anywhere. Below is my screenshot.
And one more thing, in java library how they are implemented it? separate source files for each class within a package ?