Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

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 (?) , you can switch to a simple comment.
Switch to a voting comment New
minhdev
1 week, 6 days ago
A is correct: truncatedTo() coverts the logoutTime=LoginTime => else is reached.
upvoted 1 times
...
james2033
3 months, 1 week 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
3 months, 1 week 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 ...