Qtr No. 213, New Town Yehlanka Indore 454775
Given:
public final class X {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String toString() { return getName(); }
}
and
public class Y extends X {
public Y(String name) {
super();
setName(name);
}
public static void main (String... args) {
Y y = new Y("HH");
System.out.println(y);
}
}
What is the result?
HH
Y@<<hashcode>>
null
The compilation fails
To get all Infosys Certified Java SE11 Developer Exam questions Join Group https://bit.ly/infy_premium_group
We're passionate about offering best placement materials and courses!! A one stop place for Placement Materials. We daily post Offcampus updates and Placement Materials.
Qtr No. 213, New Town Yehlanka Indore 454775
admin@prepflix.in