Question: Consider these classes: public class Item { private int x; public void setX ( int theX ) { x = theX; } / / .
Consider these classes:
public class Item
private int x;
public void setXint theX
x theX;
other methods not shown
public class EnhancedItem extends Item
private int y;
public void setYint theY
y theY;
other methods not shown
Given the following declaration in a class other than Item or EnhancedItem:
EnhancedItem obj new EnhancedItem;
Which of the following statements would compile?
I.
obj.y ;
II
obj.setY;
III.
obj.setX;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
