🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Date and Time in Java: all 10 questions

Quiz: Date and Time in Java · Question 7 of 10

What does this print? (code)

What does this print?

import java.time.*;
public class Main {
    public static void main(String[] args) {
        Duration d = Duration.between(LocalTime.of(9, 15), LocalTime.of(11, 0));
        System.out.println(d.toMinutes());
    }
}
  1. A.145
  2. B.1.75
  3. C.105
  4. D.75
Answer & explanation

Correct answer: 105

From 9:15 to 11:00 is 1 hour 45 minutes, which is 105 minutes.

Can you get the rest right without peeking?

Take the timed Quiz: Date and Time in Java quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →