English

Which of the following is implicit typecasting?

Advertisements
Advertisements

Question

Which of the following is implicit typecasting?

Options

  • int p = (int) 49.8 + 26;

  • long m = (int) 49.8*2;

  • double d = 49.8 + 56;

  • double b = 38/10;

MCQ
Advertisements

Solution

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
  Is there an error in this question or solution?
Chapter 2: Class as the Basis of all Computation - Exercises [Page 64]

APPEARS IN

Rupa Pandit Computer Applications [English] Class 10 ICSE
Chapter 2 Class as the Basis of all Computation
Exercises | Q 1. (vii) | Page 64
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×