1z1-830 Exam Question 6

Which StringBuilder variable fails to compile?
java
public class StringBuilderInstantiations {
public static void main(String[] args) {
var stringBuilder1 = new StringBuilder();
var stringBuilder2 = new StringBuilder(10);
var stringBuilder3 = new StringBuilder("Java");
var stringBuilder4 = new StringBuilder(new char[]{'J', 'a', 'v', 'a'});
}
}
  • 1z1-830 Exam Question 7

    Given:
    java
    List<String> frenchAuthors = new ArrayList<>();
    frenchAuthors.add("Victor Hugo");
    frenchAuthors.add("Gustave Flaubert");
    Which compiles?
  • 1z1-830 Exam Question 8

    Which of the following doesnotexist?
  • 1z1-830 Exam Question 9

    Given:
    java
    Map<String, Integer> map = Map.of("b", 1, "a", 3, "c", 2);
    TreeMap<String, Integer> treeMap = new TreeMap<>(map);
    System.out.println(treeMap);
    What is the output of the given code fragment?
  • 1z1-830 Exam Question 10

    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?