Confused in Netbeans
I'm monkeying around a bit in Java. I downloaded both Eclipse and Netbeans to compare the two. I like the Netbeans interface more, but I don't understand what it's doing. From what I've seen on the web to write a simple Java console program you would type the name of the class followed by the familiar public static void main, and then after that you would start typing in your source code. So it might look like this:
publicclass AddTwoIntegers
{
publicstaticvoid main( )
{
int x = 4;
int y = 3;
int sum = x + y;
System.out.println("The sum of x + y is " + sum);
}
}
That's what I've seen anyway. But in Netbeans you got this "Main class" thing. If you let the program put it in, your program works okay. If you de-select that option, it does not work. It says "No Main class set." So then if you type it in manually, it still does not work. It still says "No Main class set." I don't get it. What is this extra class doing here? And I thought that every Java program had to have the first class the exact same name as the name of your program. So if the name of your program is Add Two Integers, then the name of the class in your program must be AddTwoIntegers. But Netbeans is doing this:
package addingnumbers;
publicclass Main{
publicstaticvoid main(String[] args){
int x = 5;
int y = 3;
int sum = x + y;
System.out.println("The sum of x + y is " + sum);
}
}
I don't understand that public class Main because this is the first I've seen of it. And Eclipse doesn't even have that in there, but Netbeans does.

