Please don't put your folders in "bin." That folder is for keeping .exe files from the jdk in.
Use this procedure for command prompt use; [if you use an
IDE give the IDE a suitable path to a "java programs" folder, then let the IDE take care of all the packages.]
Create a folder called "programs" or something like that.Put all your .java files in it.In the example you have quoted, compile the files in "A" before the files in "B." As a general rule, any file without an "import" statement should be compiled first.Then compile the files which use those files in an import statement.Navigate to the location of the .java files.Use this sort of command line: c\JavaPrograms>javac -d . MyFile.java[enter] The -d means create directories, and the . means start from the current location.Run the file by prefixing the package name to the class name, eg c\JavaPrograms>java mypackage.MyClass[enter] In the example Stan James quoted the link to, you might have to say
java com.mytoppackage.mysubpackage.MyClass[enter], because there are nested folders.
There are other ways to handle packages; read what
the Java Tutorial says about them.