exam questions

Exam 98-388 All Questions

View all questions & answers for the 98-388 exam

Exam 98-388 topic 1 question 24 discussion

Actual exam question from Microsoft's 98-388
Question #: 24
Topic #: 1
[All 98-388 Questions]

You work as a Java programmer.
You need to convert a numeric String to a primitive double value.
What code segment should you use?

  • A. Double.valueOf(numberString);
  • B. double.parseDouble(numberString);
  • C. String.parseDouble(numberString);
  • D. Double.parseDouble(numberString);
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
examMan27
Highly Voted 5 years ago
D. Double.parseDouble(numberString);
upvoted 29 times
Abhitera
4 years, 4 months ago
Correct
upvoted 3 times
...
...
sam36
Highly Voted 5 years ago
D. Double.parseDouble(numberString);
upvoted 11 times
...
FearlessAIN
Most Recent 3 years, 1 month ago
The answer is D.
upvoted 1 times
...
avocadobelly
3 years, 3 months ago
Selected Answer: D
It's D
upvoted 3 times
...
Girul
3 years, 8 months ago
3 4 5 6 7 8 9 10 String strObject = "134232.324221"; try{ double d = Double.parseDouble(strObject); // <<<<<< System.out.println("String to double: " + d); }catch(NumberFormatException nfe){ System.out.println("Invalid number"); }
upvoted 1 times
...
Gtidnevsg
4 years ago
In asks for primitive so b is correct
upvoted 3 times
samuraipizza26
3 years, 12 months ago
If we need to go back to a primitive type, we need to use a parse method defined by the corresponding Wrapper Class (D) is correct.
upvoted 2 times
...
Girul
3 years, 8 months ago
// Test it! String strObject = "134232.324221"; try{ double d = Double.parseDouble(strObject); System.out.println("String to double: " + d); }catch(NumberFormatException nfe){ System.out.println("Invalid number"); }
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 ...