hi there
my first threat and first java code so these moght be dumb question for you but I will appreciate if you explain these to me.
having code and working in eclipse getting errors
:he public type cat must be defined in its own file The public type giraffe must be defined in its own file
here is the code,
public class ananimal { public void animalnoise(){ System.out.println("All animals noise is eating"); } public void walking(){ System.out.println("one foot in front of the other"); } public static void main (String[] args){ giraffe john = new giraffe(); john.animalnoise(); john.eatswhat(); john.walking(); cat timmy = new cat(); timmy.animalnoise(); timmy.eatswhat(); timmy.walking(); ananimal allanimals = new ananimal(); allanimals.animalnoise(); } } public class cat extends ananimal { public void animalnoise(){ System.out.println("Miaow, Miaow"); } public void eatswhat(){ System.out.println("Kite Kat"); } } public class giraffe extends ananimal { public void animalnoise(){ System.out.println("Giraffe noise, giraffe noise"); } public void eatswhat(){ System.out.println("Leaves on trees"); } }
THANK YOU