Skip to content

Instantly share code, notes, and snippets.

@operateur-mar
Created January 10, 2020 18:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save operateur-mar/3261c4095731ca73da1edf7f71c55972 to your computer and use it in GitHub Desktop.
Save operateur-mar/3261c4095731ca73da1edf7f71c55972 to your computer and use it in GitHub Desktop.
/* Creating Creature Class */
class Creature{
public boolean heart;
public int legs;
}
/* Using inheritance to create Human class */
class Human extends Creature{
public boolean logic;
}
/* Using inheritance to create Animal class */
class Animal extends Creature {
public boolean tail;
}
/* Creating objects */
public class Aqua {
static void main(String[] args){
/* Creating Human object */
Human P = new Human();
P.heart = true;
P.legs = 2;
P.logic = true;
/* Creating Animal Object */
Animal A = new Animal();
A.heart = true;
A.legs = 4;
P.tail = true;
}
}
/* ============================== www.aqweeb.com ==========================*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment