Solved

The Java Method Math

Question 29

Multiple Choice

The Java method Math.round can be used to round numbers. Which of the following code fragments converts a floating-point number to the nearest integer?


A) double f = 4.65;
int n = (int) Math.round(100 * f) ;
B) double f = 4.65;
int n = (int) Math.round(f) ;
C) double f = 4.65;
int n = Math.round(f) ;
D) double f = 4.65;
int n = (int) f;

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents