exam questions

Exam 1z0-808 All Questions

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

Exam 1z0-808 topic 1 question 3 discussion

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

Given the code fragment:

What is the result?

  • A. May 04, 2014T00:00:00.000
  • B. 2014-05-04T00:00: 00.000
  • C. 5/4/14T00:00:00.000
  • D. An exception is thrown at runtime.
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

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
letmein2
Highly Voted 6 years, 3 months ago
Exception in thread "main" java.time.temporal.UnsupportedTemporalTypeException: Unsupported field: HourOfDay
upvoted 16 times
Gyzmou
5 years ago
Correct, i know will be error, but tested too what exactly error will show
upvoted 1 times
...
...
Madan8899
Most Recent 1 month ago
Selected Answer: B
It will print 2014-05-04.
upvoted 1 times
...
Poornima_D
5 months ago
Selected Answer: D
Exception - Expects both date and time
upvoted 1 times
...
KarreRavi
5 months, 1 week ago
Selected Answer: B
Answer B
upvoted 1 times
...
vic88
10 months, 4 weeks ago
Exception in thread "main" java.time.temporal.UnsupportedTemporalTypeException: Unsupported field: HourOfDay at java.base/java.time.LocalDate.get0(LocalDate.java:709) at java.base/java.time.LocalDate.getLong(LocalDate.java:688) at java.base/java.time.format.DateTimePrintContext.getValue(DateTimePrintContext.java:308) at java.base/java.time.format.DateTimeFormatterBuilder$NumberPrinterParser.format(DateTimeFormatterBuilder.java:2763) at java.base/java.time.format.DateTimeFormatterBuilder$CompositePrinterParser.format(DateTimeFormatterBuilder.java:2402) at java.base/java.time.format.DateTimeFormatterBuilder$CompositePrinterParser.format(DateTimeFormatterBuilder.java:2402) at java.base/java.time.format.DateTimeFormatterBuilder$CompositePrinterParser.format(DateTimeFormatterBuilder.java:2402) at java.base/java.time.format.DateTimeFormatter.formatTo(DateTimeFormatter.java:1849) at java.base/java.time.format.DateTimeFormatter.format(DateTimeFormatter.java:1823) at java.base/java.time.LocalDate.format(LocalDate.java:1813)
upvoted 1 times
...
Elanche
11 months, 3 weeks ago
Exception in thread "main" java.time.temporal.UnsupportedTemporalTypeException: Unsupported field: HourOfDay
upvoted 1 times
...
nuray
1 year, 6 months ago
Selected Answer: D
The Problem LocalDate.parse("2014-05-04") correctly parses the string into a LocalDate object representing May 4, 2014. However, when you try to format this LocalDate with DateTimeFormatter.ISO_DATE_TIME, it throws an error because ISO_DATE_TIME expects both date and time components, but LocalDate only contains date information.
upvoted 1 times
...
Dibya17
1 year, 7 months ago
Correct answer is D as both date and time is required but here only date is provided
upvoted 1 times
...
fvelazqueznava
1 year, 10 months ago
Selected Answer: D
D is the correct
upvoted 1 times
...
gg7495
1 year, 11 months ago
Correct Answer is (d) Exception is thrown as datetime formatter requires both date and time and only date is being provided here. It will work fine if below is the input String date = LocalDate.parse("2014-05-04").format(DateTimeFormatter.ISO_DATE);
upvoted 1 times
...
Ondo
1 year, 11 months ago
Réponse B
upvoted 1 times
...
Sezam
1 year, 12 months ago
Selected Answer: D
Answer D
upvoted 1 times
...
dsms
2 years ago
Selected Answer: D
An exception is thrown at runtime.
upvoted 1 times
...
sina_
2 years ago
Selected Answer: D
.UnsupportedTemporalTypeException at .format(DateTimeFormatter.ISO_DATE_TIME);
upvoted 1 times
...
Thando_4
2 years, 1 month ago
Selected Answer: D
Exception in thread "main" java.time.temporal.UnsupportedTemporalTypeException: Unsupported field: HourOfDay
upvoted 1 times
...
NabilBenAsker
2 years, 1 month ago
Selected Answer: D
Exception in thread UnsupportTemporalTypeException.To fix this problem LocalDate.parse("2023-07-05").format(DateTimeFormatter.ISO_Local_DATE)
upvoted 1 times
...
felipegomeztreufo
2 years, 2 months ago
Exception in thread "main" java.time.temporal.UnsupportedTemporalTypeException: Unsupported field: HourOfDay
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 ...