exam questions

Exam 1z0-819 All Questions

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

Exam 1z0-819 topic 1 question 6 discussion

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

Given the code fragment:

You want to display the value of currency as $100.00.
Which code inserted on line 1 will accomplish this?

  • A. NumberFormat formatter = NumberFormat.getInstance(locale).getCurrency();
  • B. NumberFormat formatter = NumberFormat.getCurrency(locale);
  • C. NumberFormat formatter = NumberFormat.getInstance(locale);
  • D. NumberFormat formatter = NumberFormat.getCurrencyInstance(locale);
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
ASPushkin
5 days, 23 hours ago
Selected Answer: D
need to have a formater -> two cases left -> CD static NumberFormat getInstance() is like getNumberInstance() Returns a general-purpose number format public static final NumberFormat getCurrencyInstance(Locale inLocale) Returns a currency format for the specified locale answer: D
upvoted 1 times
...
ASPushkin
2 months, 2 weeks ago
Selected Answer: D
answer : D A. not correct NumberFormat formatter = NumberFormat.getInstance(locale).getCurrency(); public Currency getCurrency() returns Currency type B. not correct NumberFormat.getCurrency(locale) public Currency getCurrency() there is no parametr in this method C. not correct NumberFormat.getInstance(locale) formatter.format(currency) returns 100.00 general-purpose number format
upvoted 1 times
...
james2033
1 year, 1 month ago
Selected Answer: D
import java.text.NumberFormat; import java.util.Locale; public class Bar { public static void main(String[] args) { Locale locale = Locale.US; // Line 1. NumberFormat formatter = NumberFormat.getInstance(locale); // D. double currency = 1_00.00; System.out.println(formatter.format(currency)); } } // Result: // 100
upvoted 1 times
...
Lebannin
1 year, 4 months ago
the answer is D
upvoted 1 times
...
Stavok
1 year, 5 months ago
Selected Answer: D
D is correct
upvoted 1 times
...
Mukes877
1 year, 6 months ago
Selected Answer: D
D is right
upvoted 1 times
...
iCOW
1 year, 7 months ago
Selected Answer: D
D is the correct, as A returned the currency set for the number format.
upvoted 1 times
...
bharathdave
1 year, 7 months ago
D is the correct answer
upvoted 1 times
...
Ankit1010
1 year, 10 months ago
D is the correct answer
upvoted 1 times
...
alex_kon
2 years ago
Selected Answer: D
https://docs.oracle.com/javase/7/docs/api/java/text/NumberFormat.html#getCurrencyInstance(java.util.Locale) D
upvoted 2 times
...
Leksh_geeth
2 years, 1 month ago
Right answer is option D
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