Top Posters
Since Sunday
w
3
w
3
e
3
3
r
3
g
2
2
b
2
M
2
V
2
f
2
c
2
New Topic  
Izaganag Izaganag
wrote...
Posts: 686
Rep: 2 0
9 years ago
What is printed by the following code?
   public class Inherit
   {

      abstract class Speaker
      {
         abstract public void speak( );
      }
      class Cat extends Speaker
      {
         public void speak( )
         {
            System.out.println("Woof!");
         }
      }

      class Dog extends Speaker
      {
         public void speak( )
         {
            System.out.println("Meow!");
         }
      }

      Inherit( )
      {
         Speaker d = new Dog( );
         Speaker c = new Cat( );
         d.speak( );
         c.speak( );
      }

      public static void main(String[ ] args)
      {
         new Inherit( );
      }
   }
A) Meow!
Woof!
B) Woof!
Meow!
C) Woof!
Woof!
D) Meow!
Meow!
E) none of the above
Textbook 
Java Software Solutions: Foundations of Program Design

Java Software Solutions: Foundations of Program Design


Edition: 7th
Authors:
Read 264 times
3 Replies
Replies
Answer verified by a subject expert
habibtihabibti
wrote...
Top Poster
Posts: 1486
9 years ago
Sign in or Sign up in seconds to unlock everything for free
More solutions for this book are available here
1

Related Topics

Izaganag Author
wrote...
9 years ago
That makes life a whole lot easier, thank you for answering.
wrote...
9 years ago
Guys, you see that "vote as best answer" button below the answer, CLICK IT Slight Smile Slight Smile
New Topic      
Explore
Post your homework questions and get free online help from our incredible volunteers
  390 People Browsing
 112 Signed Up Today
Related Images
  
 323
  
 1970
  
 4846
Your Opinion
Which country would you like to visit for its food?
Votes: 264

Previous poll results: What's your favorite math subject?