Question 76

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]?
  • Question 77

    Given:

    What is the result?
  • Question 78

    Given:

    And the code fragment:

    Which code fragment, when inserted at line 14, enables the code to print Mike Found?
  • Question 79

    Given the code fragment:

    Assume that the system date is June 20, 2014. What is the result?
  • Question 80

    Given the code fragment:

    What is the result?