Object Programming  «Prev  Next»

Creating a Simple Java Class - Exercise Result

You Said:
The following is a listing of the source code for the isPoisonous() method as it appears in the Snake class definition:
Java Snake Class
  1. The Snake class definition
  2. The length member variable declaration
  3. The aggression member variable declaration
  4. The poisonous member variable declaration
  5. The isPoisonous() method definition
  6. The method body
  7. The close of the method definition
  8. Close of the class definition


Text version
class Snake {
 int length;
 int aggression;
 boolean poisonous;

 boolean isPoisonous() {
   return poisonous;
 }
}

  1. line 1: the Snake class definition
  2. line 2: the length member variable declaration
  3. line 3: the aggression member variable declaration
  4. line 4: the poisonous member variable declaration
  5. line 6: the isPoisonous() method definition
  6. line 7: the method body
  7. line 8: the close of the method definition
  8. line 9: the close of the class definition

Namecheap2