+ 6

[Challange]Bring the output of the code given below..but without creating object of class Animal..

https://code.sololearn.com/cE4JkUUKFAqS/?ref=app

22nd Jan 2018, 7:09 PM
Aaditya Deshpande
Aaditya Deshpande - avatar
2 Answers
+ 20
public class Animal { static void bark() { System.out.println("Woof-Woof"); } } class MyClass extends Animal { public static void main(String[ ] args) { bark(); } }
22nd Jan 2018, 7:42 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 9
public class Animal { void bark() { System.out.println("Woof-Woof"); } } class MyClass extends Animal { public static void main(String[ ] args) { MyClass dog = new MyClass(); dog.bark(); } }
22nd Jan 2018, 9:27 PM
LukArToDo
LukArToDo - avatar