× Didn't find what you were looking for? Ask a question
Top Posters
Since Sunday
4
n
3
j
3
o
2
x
2
c
2
2
p
2
n
2
3
2
C
2
z
2
New Topic  
Stromile Stromile
wrote...
Posts: 299
Rep: 0 0
6 years ago
What is the output of the following code?
   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.   Line
b.   Figure
c.   Shape
d.   Syntax error; this code won't compile
e.   None of these
Read 113 times
1 Reply
Replies
Answer verified by a subject expert
StingerStinger
wrote...
Posts: 310
Rep: 4 0
6 years ago
Sign in or Sign up in seconds to unlock everything for free
1

Related Topics

Stromile Author
wrote...

6 years ago
Thanks for your help!!
wrote...

Yesterday
Just got PERFECT on my quiz
wrote...

2 hours ago
Thank you, thank you, thank you!
New Topic      
Explore
Post your homework questions and get free online help from our incredible volunteers
  955 People Browsing
Related Images
  
 676
  
 129
  
 171
Your Opinion
What's your favorite coffee beverage?
Votes: 274