C Books Guide and List
C++ Books Guide and List
Best Java Books

3,749 questions

4,049 answers

114 comments

10,705 users

How to declare Class with one method?

0 votes
80 views
asked May 10, 2014 by augustaina Sr Member (4,820 points)

1 Answer

0 votes
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!
answered May 10, 2014 by sunny Expert (11,410 points)

Related questions

0 votes
1 answer 86 views
86 views asked May 10, 2014 by augustaina Sr Member (4,820 points)
0 votes
1 answer 51 views
51 views asked Jan 9, 2014 by sara Guru (24,570 points)
0 votes
1 answer 75 views
75 views asked May 10, 2014 by smith Geek (15,340 points)
0 votes
1 answer 76 views
0 votes
1 answer 77 views
77 views asked May 10, 2014 by augustaina Sr Member (4,820 points)
...