Q27 for java programing: public static void main(String[] args) { Dog[] dogs = { new Dog(), new Dog()}; for(int i = 0 ; i < dogs.length; i++) dogs[i].wo(); Cat[] cats = { new Cat(),new Cat(),new Cat()}; for(int i = 0 ; i < cats.length; i++) cats[i].me(); System.out.print(Dog.getCount()+" woofs and"); System.out.println(Cat.getCount()+" mews"); System.out.println("=====>>>"+decision()); } class Counter { private static int count; public static void inc() { count++;} public static int getCount() {return count;} } class Dog extends Counter{ public Dog(){} public void wo(){inc();} } class Cat extends Counter{ public Cat(){} public void me( ){inc();} } The Correct answer: public static void main(String[] args) { Dog[] dogs = { new Dog(), new Dog()}; for(int i = 0 ; i < dogs.length; i++) dogs[i].wo(); Cat[] cats = { new Cat(),new Cat(),new Cat()}; for(int i = 0 ; i < cats.length; i++) cats[i].me(); System.out.print(Dog.getCount()+" woofs and"); System.out.println(Cat.getCount()+" mews"); System.out.println("=====>>>"+decision()); } class Counter { private static int count; public static void inc() { count++;} public static int getCount() {return count;} } class Dog extends Counter{ public Dog(){} public void wo(){inc();} } class Cat extends Counter{ public Cat(){} public void me( ){inc();} } The Correct answer: Nothing is output 2 woofs and 5 mews 2 woofs and 3 mews 5 woofs and 5 mews
Q27 for java programing:
public static void main(String[] args) {
Dog[] dogs = { new Dog(), new Dog()};
for(int i = 0 ; i < dogs.length; i++)
dogs[i].wo();
Cat[] cats = { new Cat(),new Cat(),new Cat()};
for(int i = 0 ; i < cats.length; i++)
cats[i].me();
System.out.print(Dog.getCount()+" woofs and");
System.out.println(Cat.getCount()+" mews");
System.out.println("=====>>>"+decision()); }
class Counter
{ private static int count;
public static void inc() { count++;}
public static int getCount() {return count;}
}
class Dog extends Counter{
public Dog(){}
public void wo(){inc();}
}
class Cat extends Counter{
public Cat(){}
public void me( ){inc();}
}
The Correct answer:
public static void main(String[] args) {
Dog[] dogs = { new Dog(), new Dog()};
for(int i = 0 ; i < dogs.length; i++)
dogs[i].wo();
Cat[] cats = { new Cat(),new Cat(),new Cat()};
for(int i = 0 ; i < cats.length; i++)
cats[i].me();
System.out.print(Dog.getCount()+" woofs and");
System.out.println(Cat.getCount()+" mews");
System.out.println("=====>>>"+decision()); }
class Counter
{ private static int count;
public static void inc() { count++;}
public static int getCount() {return count;}
}
class Dog extends Counter{
public Dog(){}
public void wo(){inc();}
}
class Cat extends Counter{
public Cat(){}
public void me( ){inc();}
}
The Correct answer:
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images