ProAnswers.org

How to declare Class with one method?

public class MainClass
{
public static void main( String args[] )
{
GradeBook myGradeBook = new GradeBook();

  myGradeBook.displayMessage();

}
}
class GradeBook
{
public void displayMessage()
{
System.out.println( “Welcome to the Grade Book!” );
}
}
output
Welcome to the Grade Book!
it is an animal!