Advertisements
Advertisements
प्रश्न
Which of the following is implicit typecasting?
विकल्प
int p = (int) 49.8 + 26;long m = (int) 49.8*2;double d = 49.8 + 56;double b = 38/10;
MCQ
Advertisements
उत्तर
double d = 49.8 + 56;
Explanation:
In this statement, you are adding a decimal double (49.8) to a whole number int (56). Java automatically converts the smaller integer type into a double type (56.0) during runtime so it can perform the math smoothly without any manual syntax or data loss.
shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 2: Class as the Basis of all Computation - Exercises [पृष्ठ ६४]
