× Didn't find what you were looking for? Ask a question
Top Posters
Since Sunday
o
4
b
4
4
s
3
j
3
b
3
m
3
K
3
g
3
L
3
w
3
m
3
New Topic  
Izaganag Izaganag
wrote...
Posts: 686
Rep: 2 0
8 years ago
What is printed?

   public class Inherit
   {

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

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

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

      Inherit( )
      {
         Figure f = new Figure( );
         Rectangle r = new Rectangle( );
         Box b = new Box( );
         f.display( );
         f = r;
         f.display( );
         f = b;
         f.display( );
      }

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

Java Software Solutions: Foundations of Program Design


Edition: 7th
Authors:
Read 249 times
2 Replies

Related Topics

Replies
wrote...
8 years ago
A?
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.
New Topic      
Explore
Post your homework questions and get free online help from our incredible volunteers
  1102 People Browsing
Related Images
  
 396
  
 1118
  
 220
Your Opinion
Which industry do you think artificial intelligence (AI) will impact the most?
Votes: 405