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 5 years, 7 months ago
Exception in thread "main" java.time.temporal.UnsupportedTemporalTypeException: Unsupported field: HourOfDay
upvoted 16 times
Gyzmou
4 years, 4 months ago
Correct, i know will be error, but tested too what exactly error will show
upvoted 1 times
...
...
vic88
Most Recent 2 months, 2 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
3 months, 2 weeks ago
Exception in thread "main" java.time.temporal.UnsupportedTemporalTypeException: Unsupported field: HourOfDay
upvoted 1 times
...
nuray
10 months, 1 week 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
11 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, 1 month ago
Selected Answer: D
D is the correct
upvoted 1 times
...
gg7495
1 year, 2 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, 2 months ago
Réponse B
upvoted 1 times
...
Sezam
1 year, 3 months ago
Selected Answer: D
Answer D
upvoted 1 times
...
dsms
1 year, 4 months ago
Selected Answer: D
An exception is thrown at runtime.
upvoted 1 times
...
sina_
1 year, 4 months ago
Selected Answer: D
.UnsupportedTemporalTypeException at .format(DateTimeFormatter.ISO_DATE_TIME);
upvoted 1 times
...
Thando_4
1 year, 5 months ago
Selected Answer: D
Exception in thread "main" java.time.temporal.UnsupportedTemporalTypeException: Unsupported field: HourOfDay
upvoted 1 times
...
NabilBenAsker
1 year, 5 months 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
1 year, 6 months ago
Exception in thread "main" java.time.temporal.UnsupportedTemporalTypeException: Unsupported field: HourOfDay
upvoted 1 times
...
Vicky_65
1 year, 8 months ago
Selected Answer: D
it will thow an datetimeexception at runtime
upvoted 1 times
...
willokans
2 years ago
Answer is D - UnsupportedTemporalTypeException (looking for LocalDate but parse DateTimeFormatter.ISO_DATE_TIME
upvoted 2 times
...
carloswork
2 years, 1 month ago
Selected Answer: D
Answer is D. Source code throws "Exception in thread "main" java.time.temporal.UnsupportedTemporalTypeException: Unsupported field: HourOfDay" To test: Remember: import java.time.LocalDate; import java.time.format.DateTimeFormatter; public static void main(String[] args) { String date = LocalDate .parse("2014-05-04") .format(DateTimeFormatter.ISO_DATE_TIME); System.out.println(date); }
upvoted 3 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