Question

Question 28 public class Main public static void main(String args[]) { Iparentp=new Child (1.2); p.printo: interface Iparent
public int x = 1; public void print(); class Child implements Iparent! private int y public Child(int a, in lb) y=b; public v
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Here, Object of interface Iparent is created and named as ' p ' and constructor of class Child is called with the parameters 1, 2.

Therefore, a becomes 1 and b becomes 2. Now inside the constructor y = b . => y becomes 2.

The print function of class Child is called with the object of interface Iparent. => Child y => Child 2 will be printed.

Therefore, the second option 'Child 2' is correct.

Add a comment
Know the answer?
Add Answer to:
Question 28 public class Main public static void main(String args[]) { Iparentp=new Child (1.2); p.printo: interface...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT