Oracle
1Z0-829 · Question #28
1Z0-829 Question #28: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-829 to reveal the answer and full explanation for question #28. The question stem and answer options stay visible for context.
Java Object-Oriented Approach
Question
record Product(int pNumber, String pName) {
int regNo = 100;
public int getRegNumber() {
return regNo;
}
}
public class App {
public static void main(String[] args) {
Product p1 = new Product(1111, "Ink Bottle");
}
}
Which action enables the code to compile?
Options
- AReplace record with void.
- BRemove the regNO initialization statement.
- CMake the regNo variable static.
- DReplace thye regNo variable static
- EMake the regNo variable public
Unlock 1Z0-829 to see the answer
You've previewed enough free 1Z0-829 questions. Unlock 1Z0-829 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.
Topics
#Records#Instance fields#Initialization#Syntax rules