1z0-830 Exam Question 16

Given:
java
final Stream<String> strings =
Files.readAllLines(Paths.get("orders.csv"));
strings.skip(1)
.limit(2)
.forEach(System.out::println);
And that the orders.csv file contains:
mathematica
OrderID,Customer,Product,Quantity,Price
1,Kylian Mbappe,Keyboard,2,25.50
2,Teddy Riner,Mouse,1,15.99
3,Sebastien Loeb,Monitor,1,199.99
4,Antoine Griezmann,Headset,3,45.00
What is printed?
  • 1z0-830 Exam Question 17

    What do the following print?
    java
    public class Main {
    int instanceVar = staticVar;
    static int staticVar = 666;
    public static void main(String args[]) {
    System.out.printf("%d %d", new Main().instanceVar, staticVar);
    }
    static {
    staticVar = 42;
    }
    }
  • 1z0-830 Exam Question 18

    What do the following print?
    java
    public class DefaultAndStaticMethods {
    public static void main(String[] args) {
    WithStaticMethod.print();
    }
    }
    interface WithDefaultMethod {
    default void print() {
    System.out.print("default");
    }
    }
    interface WithStaticMethod extends WithDefaultMethod {
    static void print() {
    System.out.print("static");
    }
    }
  • 1z0-830 Exam Question 19

    Given:
    java
    public class Test {
    public static void main(String[] args) throws IOException {
    Path p1 = Path.of("f1.txt");
    Path p2 = Path.of("f2.txt");
    Files.move(p1, p2);
    Files.delete(p1);
    }
    }
    In which case does the given program throw an exception?
  • 1z0-830 Exam Question 20

    Given:
    java
    StringBuffer us = new StringBuffer("US");
    StringBuffer uk = new StringBuffer("UK");
    Stream<StringBuffer> stream = Stream.of(us, uk);
    String output = stream.collect(Collectors.joining("-", "=", ""));
    System.out.println(output);
    What is the given code fragment's output?