0

What's wrong in this code

class Animal{ int legs; String type; static void sound(){ system.out.println("Hmm"); } class Dog extends Animal{ Dog(int legs,String type){ this.legs=legs; this.type=type; static void sound(){ system.out.print("Va"); } static void description(){ System.out.print("i have" +legs ); } } } } public class Program { public static void main(String[] args) { Dog d =new Dog(4,"samuski"); d.description(); } }

28th May 2020, 9:55 AM
Shivam Rawal
5 Respostas
+ 4
You have a couple of errors including misplaced curly braces and system must start with a capital 'S'. Also I made one of the instance variable static and the reason is mentioned alongside. https://code.sololearn.com/cenH8oQ8vR7G/?ref=app
28th May 2020, 10:15 AM
Avinesh
Avinesh - avatar
0
K
28th May 2020, 9:56 AM
Shivam Rawal
28th May 2020, 9:58 AM
Shivam Rawal
0
Tysm
28th May 2020, 10:30 AM
Shivam Rawal