// 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
// 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
No comments:
Post a Comment