Why the answer is c ? can anyone tell me why ? thanks public class Player extend
ID: 653633 • Letter: W
Question
Why the answer is c ?
can anyone tell me why ? thanks
public class Player extends Point { private String myName; public Player( Point p. String name ) { super( p ); myName = name; } public String getName(){ return myName; } } public class HuckleBuckle { public static void main( String[] args ) { Point p = new Point( 0, 0 ); Player s = new Player( p, "Sue" ); Point xl = s; Player x2 = p; System.out.println( s.myName ); System.out.println( ((Player) x1).getName() ); } Which of the following is TRUE about line 6 of Hucklebuckle? This statement will compile, and will not throw an exception or run-time error if it is executed. This statement will compile, and will throw an exception or run-time error if it is executed. This statement will not compile. Write your answer (a, b, or c) in the following box.Explanation / Answer
There is an object 's' of player class and there is a statement given Point x1 = s.
Hence, the line 8 will compile and give output as 'Sue'.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.