I am currently in a Java class using Java: How to Program, Ninth Edition
I am following the book in creating a GradeBook and have come across an error stating no main classes found.
Here is the code for the two files in my project folder:
GradeBook.java
// Fig. 2.1: GradeBook.java
// Class declaration with one method.
public class GradeBook
{
// display a welcome message to the GradeBook user
public void displayMessage()
{
System.out.println ( "Welcome to the Grade Book!");
} // end method displayMessage
} // end class GradeBook
GradeBookTest.java
// Fig. 3.2: GradeBookTest.java
// Creating a GradeBook object and calling its displayMessage method.
public class GradeBookTest
{
// main method begins program execution
public static void main( String[] args )
{
// create a GradeBook object and assign it to myGradeBook
GradeBook myGradeBook = new GradeBook();
// call myGradeBook's displayMessage method
myGradeBook.displayMessage();
} // end main
} // end class GradeBookTest
I am using the NetBeans IDE to create and run my projects. It is only my second week into my Java class so I am still learning and working my way around NetBeans and Java. Any advice would be awesome.
If it was eclipse, I would have just run the main method in the GradeBookTest. Are you trying to run the project ? or just the GradeBookTest main ?
Try running GradeBookTest.