What is the result?

Given the code fragment:

What is the result?
A. [Robb, Rick, Bran]
B. [Robb, Rick]
C. [Robb, Bran, Rick, Bran]
D. An exception is thrown at runtime.

Download Printable PDF. VALID exam to help you PASS.

2 thoughts on “What is the result?

  1. A
    public static void main(String[] args) {
    List names = new ArrayList();
    names.add(“Robb”);
    names.add(“Bran”);
    names.add(“Rick”);
    names.add(“Bran”);

    if (names.remove(“Bran”)){
    names.remove(“Jon”);
    }
    System.out.println(names);
    }

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.