Oracle
1Z0-803 · Question #52
Given the following code: What will make this code compile and run?
The correct answer is E. Change line 5 to the following:. price.price =4; is correct, not price=4; The attribute price of the instance must be set, not the instance itself.
Java Basics
Question
Given the following code:
What will make this code compile and run?
Exhibit
Options
- AChange line 2 to the following:
- BChange line 4 to the following:
- CChange line 4 to the following:
- DChange line 5 to the following:
- EChange line 5 to the following:
- FChange line 5 to the following:
- GChange line 5 to the following:
- HThe code compiles and runs properly; no changes are necessary
How the community answered
(40 responses)- A3% (1)
- E85% (34)
- G5% (2)
- H8% (3)
Explanation
price.price =4; is correct, not price=4; The attribute price of the instance must be set, not the instance itself.
Topics
#compilation errors#syntax correction#static keyword#access modifiers
Community Discussion
No community discussion yet for this question.
