Saved Bookmarks
| 1. |
Predict the return data types of the following: (i) int p; double q;r = p + q;System.out.println(r);(ii) float m;p = m/3*(Math.pow(4,3));System.out.println(p); |
|
Answer» 1) double and 2) errorExplanation:1) the COMPILER will implicitly convert INT to double2) Math.pow() FUNCTION returns a double and float + double is a double but since p is an int the compiler will return an EXCEPTION "possible loss of precision". |
|