MultipleChoice
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?
OptionsMultipleChoice
Given the code fragment:
List
Predicate
System.out.println(''Searching...'');
return n.contains(''red'');
};
colors.stream()
.filter(c -> c.length() > 3)
.allMatch(test);
What is the result?
OptionsMultipleChoice
Given:
class UserException extends Exception { }
class AgeOutOfLimitException extends UserException { }
and the code fragment:
class App {
public void doRegister(String name, int age)
throws UserException, AgeOutOfLimitException {
if (name.length () < 6) {
throw new UserException ();
} else if (age >= 60) {
throw new AgeOutOfLimitException ();
} else {
System.out.println(''User is registered.'');
}
}
public static void main(String[ ] args) throws UserException {
App t = new App ();
t.doRegister(''Mathew'', 60);
}
}
What is the result?
OptionsMultipleChoice
Given the content:
and given the code fragment:
Which two code fragments, when inserted at line 1 independently, enable the code to print ''Wie geht's?''
OptionsMultipleChoice
Given the code fragments:
class ThreadRunner implements Runnable {
public void run () { System.out.print (''Runnable'') ; }
}
class ThreadCaller implements Callable {
Public String call () throws Exception {return ''Callable''; )
}
and
ExecutorService es = Executors.newCachedThreadPool ();
Runnable r1 = new ThreadRunner ();
Callable c1 = new ThreadCaller ();
// line n1
es.shutdown();
Which code fragment can be inserted at line n1 to start r1 and c1 threads?
Options