Return to site

JAVA CERTIFICATION QUESTION: Working with date and time in Java

· java,ocp

Someone is traveling from the Chicago O’Hare airport (ORD) in the United States to the Warsaw airport (WAW) in Poland.

Calculate the duration.

The information printed on her ticket is as follows:

 

Depart Chicago O’Hare

Scheduled: March 27, 2021 5:30 PM (17:30)

Arrive Warsaw

Scheduled: March 28, 2021 9:35 AM (09:35)

 

She has written the following incomplete code:

 

What code does she insert at line n1 to calculate the elapsed time expected between departure and arrival? Choose one.

A. long timeInPlane = ChronoUnit.HOURS.between(ord, waw);

 

B.

Period timeInPlane = Period.between(

     ord, ZoneId.of("America/Chicago"),

     waw, ZoneId.of("Europe/Warsaw"));

 

C. Period timeInPlane = Period.between(ord, waw);

 

D. Duration timeInPlane = Duration.between(ord, waw);

 

 

 

 

 

 

 

 

·ꓷ uoᴉʇdo sᴉ ɹǝʍsuɐ ʇɔǝɹɹoɔ ǝɥꓕ