1Z0-808 Web TestEngine demo

Exit VCEDump 1Z0-808 Java SE 8 Programmer I
Question 9 of 58
0% complete
Q9 Single choice

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]?

Sign in to mark questions

Sign in to save marked questions and return to this demo.

Sign in