Exit 1Z0-811 Java Foundations
Question 1 of 5
0% complete
Q1 Multiple choice

Given the code fragment:

Which two code fragments are valid at line 2?

Select all that apply.

  • A

    for (int count = 0; count < 5; count++) {

    System.out.print(count);
    }

  • B

    package p1;

  • C

    import java.util.*;
    public void display() {
    List<Integer> nums = new ArrayList<> ();
    }

  • D

    {
    private int num;
    }

  • E

    private String name = "John";
    public void display() {
    System.out.print(name);
    }

Previous Next