× Didn't find what you were looking for? Ask a question
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  
Stromile Stromile
wrote...
Posts: 299
Rep: 0 0
5 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 111 times
1 Reply
Replies
Answer verified by a subject expert
StingerStinger
wrote...
Posts: 310
Rep: 4 0
5 years ago
Sign in or Sign up in seconds to unlock everything for free
1

Related Topics

Stromile Author
wrote...

5 years ago
Smart ... Thanks!
wrote...

Yesterday
Correct Slight Smile TY
wrote...

2 hours ago
This site is awesome
New Topic      
Explore
Post your homework questions and get free online help from our incredible volunteers
  1315 People Browsing
Related Images
  
 165
  
 340
  
 672
Your Opinion
Which of the following is the best resource to supplement your studies:
Votes: 292

Previous poll results: Do you believe in global warming?