What is the difference between the result of the following two Java statements?
I. int cents = (int) (100 * price + 0.5) ;
II. int cents = (100 * price + 0.5) ;
A) Statement I causes truncation, but II does not
B) Statement II causes truncation, but I does not
C) Statement I compiles, but II does not
D) Statement II compiles, but I does not
Correct Answer:
Verified
Q11: Which option represents the best choice for
Q16: Which statement about number literals in Java
Q60: Which of the following is the
Q61: What does the following statement sequence print?
Q62: What does the following statement sequence print?
Q63: What does the following statement sequence print?
Q64: What is the output of this code
Q66: What does the following statement sequence print?
Q67: What is the output of the following
Q68: What is the output of the following
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents