PRASHNIKAप्रश्निका
‹ Back to the paper

The following statement will generate a compile time error. This can be rectified in 2 different…

Computer Science20251 markShort answer
The following statement will generate a compile time error. This can be rectified in 2 different ways, without losing precision of price. Write these statements.
float price = 17.99;

Answer

Answer

AI
float price = 17.99f; or float price = (float) 17.99;
Primitive values, Wrapper classes, Types and casting

From ISC Computer Science - Competency Focused Practice Questions (CISCE, August 2024), question 35.