+ 1

help ( java ) I m a beginner. Please decode.

https://code.sololearn.com/cemaELu2ce5o

13th Nov 2018, 3:38 PM
Android
Android - avatar
3 odpowiedzi
+ 1
@mike thank you very much
13th Nov 2018, 4:14 PM
Android
Android - avatar
0
Well there are a couple of things wrong with your code. If you want classes and subclasses you need to make the cat class extend the animal class for starters. You also forgot to make the values and the propert function public. // Created by kxlee public class Animals{ public String name; public int age; public int legs; static class Cats extends Animals { int legs = 4; public void propert() { System.out.print("Miow, my name is " + this.name); System.out.println("my age is " + this.age + " , I have " + legs + " legs." ); } } } class MyClass{ public static void main(String []args){ Animals.Cats jex=new Animals.Cats(); jex.name="Jex"; jex.age=14; jex.propert(); } }
13th Nov 2018, 4:09 PM
Mike
0
You just posted the same code from before but here is my working version of it. https://code.sololearn.com/cql5KqOF9f5a/?ref=app
13th Nov 2018, 4:41 PM
Mike