Question 11

Given:
java
public class Versailles {
int mirrorsCount;
int gardensHectares;
void Versailles() { // n1
this.mirrorsCount = 17;
this.gardensHectares = 800;
System.out.println("Hall of Mirrors has " + mirrorsCount + " mirrors."); System.out.println("The gardens cover " + gardensHectares + " hectares.");
}
public static void main(String[] args) {
var castle = new Versailles(); // n2
}
}
What is printed?
  • Question 12

    Given a properties file on the classpath named Person.properties with the content:
    ini
    name=James
    And:
    java
    public class Person extends ListResourceBundle {
    protected Object[][] getContents() {
    return new Object[][]{
    {"name", "Jeanne"}
    };
    }
    }
    And:
    java
    public class Test {
    public static void main(String[] args) {
    ResourceBundle bundle = ResourceBundle.getBundle("Person");
    String name = bundle.getString("name");
    System.out.println(name);
    }
    }
    What is the given program's output?
  • Question 13

    Which three of the following are correct about the Java module system?
  • Question 14

    Given:
    java
    var deque = new ArrayDeque<>();
    deque.add(1);
    deque.add(2);
    deque.add(3);
    deque.add(4);
    deque.add(5);
    System.out.print(deque.peek() + " ");
    System.out.print(deque.poll() + " ");
    System.out.print(deque.pop() + " ");
    System.out.print(deque.element() + " ");
    What is printed?
  • Question 15

    How would you create a ConcurrentHashMap configured to allow a maximum of 10 concurrent writer threads and an initial capacity of 42?
    Which of the following options meets this requirement?