Top Posters
Since Sunday
g
3
3
2
J
2
p
2
m
2
h
2
s
2
r
2
d
2
l
2
a
2
New Topic  
Izaganag Izaganag
wrote...
Posts: 686
Rep: 2 0
8 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 235 times
3 Replies
Replies
Answer verified by a subject expert
habibtihabibti
wrote...
Top Poster
Posts: 1486
8 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...
8 years ago
That makes life a whole lot easier, thank you for answering.
wrote...
8 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
  1167 People Browsing
 107 Signed Up Today
Related Images
  
 283
  
 876
  
 261
Your Opinion
Who will win the 2024 president election?
Votes: 3
Closes: November 4

Previous poll results: What's your favorite coffee beverage?