Exam 1z0-829 All QuestionsBrowse all questions from this exam
Question 5

Given the code fragment:

What is the result?

    Correct Answer: B

    The code fragment defines and prints a Duration and a Period. Initially, a Duration of 5000 milliseconds is created, which equals to 5 seconds and will be printed as PT5S. Then the Duration is updated to 60 seconds, which equals to 1 minute and will be printed as PT1M. Finally, a Period of 6 days is printed as P6D. Therefore, the output of the program will be PT5SPT1MP6D.

Discussion
minhdevOption: B

Period: P#(Y,M,D) Duration: PT#(H, M, S) Result: PT5SPT1MP6D B is correct answer

UtemanOption: B

B is correct

james2033Option: B

package q05; import java.time.Duration; import java.time.Period; public class Q05 { public static void main(String[] args) { Duration duration = Duration.ofMillis(5000); System.out.print(duration); duration = Duration.ofSeconds(60); System.out.print(duration); Period period = Period.ofDays(6); System.out.print(period); } } // Result: // PT5SPT1MP6D

SampsOption: B

B is correcct