Beginner Java Compile Questions

Hey, I’m using Netbeans and I have to create a project to make individual files. I having trouble with this because for a project I named LearningJava and it has several folders:

Source Packages
LearningJava (Where the main.java is, and my own classes I think)
Test Packages
Libraries (The JDK)
Test Libraries

So far it seems these are true, please correct me if im wrong:

  1. Main.java is kind of like an index file where everything is launched from.

  2. Any other classes within this project must have package LearningJava; at the top, so it knows it’s part of this project and wouldn’t conflict with other libraries in the future. Which I don’t totally understand, in a lot of sample content from websites I don’t see this.

  3. When I compile a java file it always compiles the Main.java file, so call methods from other classes if I want to see them.

  4. You can’t compile a java file and run it if it has no Main.java file

Is this the right track?

I have run java from CLI using java and javac, but I’d like it to work and check errors like it does already.

  1. Yes

  2. Anything that has the same package (like namespaces in PHP) will not conflict with other library scripts that maybe in your project.

  3. Kind of, see #4 .

  4. You don’t have to have a Main.java. You can in fact, delete it, and create another java file called Application.java and set it as your “main” file.