+ 6
[Challange]Bring the output of the code given below..but without creating object of class Animal..
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();
}
}
+ 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();
}
}