Top Posters
Since Sunday
5
a
5
k
5
c
5
B
5
l
5
C
4
s
4
a
4
t
4
i
4
r
4
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 Rectangle
      {
         void display( )
         {
            System.out.println("Box");
         }
      }

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

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

Java Software Solutions: Foundations of Program Design


Edition: 7th
Authors:
Read 206 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
  1327 People Browsing
Related Images
  
 140
  
 344
  
 245
Your Opinion
Which industry do you think artificial intelligence (AI) will impact the most?
Votes: 352