Saturday, 30 July 2011

Concept of Inheritance in Java


//create a class Human  in java
class Human{
String Name;
int Age;
public void setAge(int a){
Age=a;
}//end of set
public int getAge(){
return Age;
}// end of get

public void setName(String n){
Name=n;
}// end of set

public String getName()
{
return Name;
}// end of get


}//end of main class

No comments:

Post a Comment