exam questions

Exam 1z0-829 All Questions

View all questions & answers for the 1z0-829 exam

Exam 1z0-829 topic 1 question 4 discussion

Actual exam question from Oracle's 1z0-829
Question #: 4
Topic #: 1
[All 1z0-829 Questions]

Given the code fragment:

What is the result?

  • A. Can't logout
  • B. Logged out at: 2021-01-12T21:58:00z
  • C. A compilation error occurs at line n1.
  • D. Logged out at: 2021-01-12T21:58:19.880z
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Uteman
5 months, 4 weeks ago
Outputs Can't logout
upvoted 1 times
...
xplorerpj
6 months, 2 weeks ago
A is correct
upvoted 1 times
...
minhdev
7 months, 3 weeks ago
A is correct: truncatedTo() coverts the logoutTime=LoginTime => else is reached.
upvoted 2 times
...
james2033
10 months, 2 weeks ago
Selected Answer: A
package q04; import java.time.Instant; import java.time.temporal.ChronoUnit; public class Q04 { public static void main(String[] args) throws InterruptedException { // Login time: 2021-01-12T21:58:18.817Z Instant loginTime = Instant.now(); Thread.sleep(1000); // Logout time: 2021-01-12T21:58:19.880Z Instant logoutTime = Instant.now(); loginTime = loginTime.truncatedTo(ChronoUnit.MINUTES); // line n1 logoutTime = logoutTime.truncatedTo(ChronoUnit.MINUTES); if (logoutTime.isAfter(loginTime)) { System.out.println("Logged out at: " + logoutTime); } else { System.out.println("Can't logout"); } } } // Result: // Can't logout
upvoted 2 times
...
Samps
10 months, 3 weeks ago
Selected Answer: A
A is correct
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago