I have a file called Class1.java and inside I have 3 classes defined, one is public access the other two are package access, I have another file called class2.java, how can I access the package access classes in class1 within class2? I tried putting class1 into a package and then importing that package in class2, but its not working, thanks.
In general, the idea is that if you have multiple classes in a source file, some of them won't have the same name as the source file, and so they're a little hard for the compiler to find. Therefore, the best plan is to only include multiple classes in a single file if those classes won't be used by other classes in other files, but only by classes in the same file. Otherwise, it just makes life easier for each class to be in its own file, with the file named after the class.
But the technical solution is to compile the multiple source files on the same command line, at the same time; in other words, whereas