Class Person

java.lang.Object
  |
  +--Person

public class Person
extends java.lang.Object

Person class is used as a base class for an inheritance example.


Field Summary
protected  char gender
          gender of this Person (either 'M' or 'F')l
protected  java.lang.String name
          name of this Person.
 
Constructor Summary
Person(java.lang.String n, char g)
          Constructs a Person object using the passed parameters.
 
Method Summary
 void laugh()
          this Person laughs by printing an informative message: "Person xxx laughs.", where xxx is the name of this Person.
 void sleep()
          this Person sleeps by printing an informative message: "Person xxx sleeps.", where xxx is the name of this Person.
 java.lang.String toString()
          returns a string representation of this Person.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected java.lang.String name
name of this Person.


gender

protected char gender
gender of this Person (either 'M' or 'F')l

Constructor Detail

Person

public Person(java.lang.String n,
              char g)
Constructs a Person object using the passed parameters.

Method Detail

laugh

public void laugh()
this Person laughs by printing an informative message: "Person xxx laughs.", where xxx is the name of this Person.


sleep

public void sleep()
this Person sleeps by printing an informative message: "Person xxx sleeps.", where xxx is the name of this Person.


toString

public java.lang.String toString()
returns a string representation of this Person.

Overrides:
toString in class java.lang.Object