exam questions

Exam 1z0-808 All Questions

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

Exam 1z0-808 topic 1 question 170 discussion

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

Given the code fragment:

What is the result?

  • A. An exception is thrown at runtime.
  • B. 2014-07-31T01:01:00
  • C. 2014-07-31
  • D. 2014-09-30T00:00:00
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

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
DriftKing
4 months, 1 week ago
Selected Answer: B
Answer is B. 2014-07-31T01:01:00 Code - import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; public class Test{ public static void main(String[] args) { LocalDateTime dt = LocalDateTime.of(2014, 7, 31, 1, 1); dt.plusDays(30); dt.plusMonths(1); System.out.println(dt.format(DateTimeFormatter.ISO_DATE_TIME)); } }
upvoted 1 times
...
iSnover
1 year, 3 months ago
Selected Answer: B
The correct answer is the letter B. For the simple fact that an exception cannot occur because even without placing the seconds, as it is an int, it assigns the value of 0 by default in the "dt" variable instantiation line. Lines 2 and 3 are useless because Date is immutable so to receive the value of the methods it would need to be assigned to a variable, so the 2 operations were lost. In line 4 printed the date in ISO format which is the answer of the letter B.
upvoted 1 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