Question 96

Given the code fragment:
ZonedDateTime depart = ZonedDateTime.of(2015, 1, 15, 3, 0, 0, 0, ZoneID.of ( "UTC-7"));
ZonedDateTime arrive = ZonedDateTime.of(2015, 1, 15, 9, 0, 0, 0, ZoneID.of ( "UTC-5"));
long hrs = ChronoUnit.HOURS.between(depart, arrive); //line n1
System.out.println("Travel time is" + hrs + "hours");
What is the result?
  • Question 97

    Given the code fragment:
    ZonedDateTime depart = ZonedDateTime.of(2015, 1, 15, 3, 0, 0, 0, ZoneID.of("UTC-7")); ZonedDateTime arrive = ZonedDateTime.of(2015, 1, 15, 9, 0, 0, 0, ZoneID.of("UTC-5")); long hrs = ChronoUnit.HOURS.between(depart, arrive); //line n1 System.out.println("Travel time is" + hrs + "hours"); What is the result?
  • Question 98

    Given the content of /resourses/Message.properties:
    welcome1="Good day!"
    and given the code fragment:
    Properties prop = new Properties ();
    FileInputStream fis = new FileInputStream
    ("/resources/Message.properties");
    prop.load(fis);
    System.out.println(prop.getProperty("welcome1"));
    System.out.println(prop.getProperty("welcome2", "Test"));//line n1
    System.out.println(prop.getProperty("welcome3"));
    What is the result?
  • Question 99

    Given the code fragment:
    public class FileThread implements Runnable {
    String fName;
    public FileThread(String fName) { this.fName = fName; }
    public void run () System.out.println(fName);}
    public static void main (String[] args) throws IOException,
    InterruptedException {
    ExecutorService executor = Executors.newCachedThreadPool();
    Stream<Path> listOfFiles = Files.walk(Paths.get("Java Projects"));
    listOfFiles.forEach(line -> {
    executor.execute(new FileThread(line.getFileName().toString
    ())); //
    line n1
    });
    executor.shutdown();
    executor.awaitTermination(5, TimeUnit.DAYS); //
    line n2
    }
    }
    The Java Projects directory exists and contains a list of files.
    What is the result?
  • Question 100

    Given:

    What is the result?