java - Is it possible to create multiple classes in one package and import them in another package? -
hi have question on java package. have created package more 1 classes [package name 'animal' , file name 'zoo.java']. have created java file in package 'mypackage' , created file called 'main.java'. tried accessing members of 'animal' package 'main.java' , throwing me error because cannot access classes of 'animal' package. know classes in same package should accessible each other, or should make public. can change 1 class public in 'zoo.java'. found 1 solution create separate java files each class in animal package , make public. there other method ? understanding was, can write classes in 1 file , import them anywhere. below screenshot. and 1 more thing, in java library how implemented it? separate source files each class within package ? so found 1 solution create separate java files each class in animal package , make public. if want use classes outside of package they're defined in, yes, have...