Oracle
1Z0-803 · Question #264
1Z0-803 Question #264: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-803 to reveal the answer and full explanation for question #264. The question stem and answer options stay visible for context.
Question
Given the code fragment: class Student { int rollnumber; String name; List cources = new ArrayList(); // insert code here public String toString() { return rollnumber + " : " + name + " : " + cources; } } And, public class Test { public static void main(String[] args) { List cs = newArrayList(); cs.add("Java"); cs.add("C"); Student s = new Student(123,"Fred", cs); System.out.println(s); } } Which code fragment, when inserted at line // insert code here, enables class Test to print 123 : Fred : [Java, C]?
Options
- Aprivate Student(int i, String name, List cs) {
- Bpublic voidStudent(int i, String name, List cs) {
- CStudent(int i, String name, List cs) {
- DStudent(int i, String name,ArrayList cs) {
Unlock 1Z0-803 to see the answer
You've previewed enough free 1Z0-803 questions. Unlock 1Z0-803 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.