Created
January 10, 2020 18:52
-
-
Save operateur-mar/3261c4095731ca73da1edf7f71c55972 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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