Knowee
Questions
Features
Study Tools

To create an instance of BigDecimal for 454.45, use  _____A. BigInteger(454.45);B. new BigInteger(454.45);C. BigInteger("454.45");D. new BigDecimal("454.45");

Question

To create an instance of BigDecimal for 454.45, use


A. BigInteger(454.45);
B. new BigInteger(454.45);
C. BigInteger("454.45");
D. new BigDecimal("454.45");

🧐 Not the exact question you are looking for?Go ask a question

Solution

The correct answer is D. new BigDecimal("454.45");

Here's why:

A. BigInteger(454.45); - This is incorrect because BigInteger is used for integer numbers, not decimal numbers. Also, the syntax is incorrect. You need to use the "new" keyword to create an instance.

B. new BigInteger(454.45); - This is incorrect for the same reasons as option A. BigInteger is not used for decimal numbers and the argument should be a string.

C. BigInteger("454.45"); - This is incorrect because BigInteger is not used for decimal numbers. Also, the syntax is incorrect. You need to use the "new" keyword to create an instance.

D. new BigDecimal("454.45"); - This is correct. BigDecimal is used for decimal numbers and the argument is correctly passed as a string. The "new" keyword is used to create an instance.

This problem has been solved

Similar Questions

To add BigInteger b1 to b2, you write  _____ .A. b1.add(b2);B. b1 = b2.add(b1);C. b2 = b1.add(b2);D. b2 = b2.add(b1);

Select the correct answerWhich of the following is the advantage of BigDecimal over double?OptionsGarbage creationMemory usageSyntaxPrecisio

Select the correct answerWhich of the following is not provided by BigDecimal?Optionsrounding+ operatorscale manipulationhashing

Select the correct answerWhich of the below data type doesn’t support overloaded methods for +,-,* and /?OptionsfloatintdoubleBigDecimal

Which of the following is the advantage of BigDecimal over double?OptionsMemory usageSyntaxGarbage creationPrecision

1/1

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.