Top Posters
Since Sunday
New Topic  
Izaganag Izaganag
wrote...
Posts: 686
Rep: 2 0
8 years ago
What is printed?

   public class Inherit
   {

      abstract class Figure
      {
         void display( )
         {
            System.out.println("Figure");
         }
      }

      class Line extends Figure
      {
         void display( )
         {
            System.out.println("Line");
         }
      }

      void tryme(Figure f)
      {
         f.display( );
      }

      Inherit( )
      {
         Figure f = new Line( );
         tryme(f);
      }

      public static void main(String[ ] args)
      {
         new Inherit( );
      }
   }
A) Shape
B) Line
C) Figure
D) Syntax error; the code won't even compile
E) none of the above
Textbook 
Java Software Solutions: Foundations of Program Design

Java Software Solutions: Foundations of Program Design


Edition: 7th
Authors:
Read 188 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
I regret taking this computer science course. Should just stick to history Face with Stuck-out Tongue Thanks for your help.
wrote...
8 years ago
Give me a shout if you need anymore help.
New Topic      
Explore
Post your homework questions and get free online help from our incredible volunteers
  1238 People Browsing
Related Images
  
 340
  
 8206
  
 755
Your Opinion
Who's your favorite biologist?
Votes: 586