English

Identify the incorrect statement. (a) long g = 65.8; (b) int t = 72; (c) byte b = 3; (d) double h = 92;

Advertisements
Advertisements

Question

Identify the incorrect statement.

Options

  • long g = 65.8;

  • int t = 72;

  • byte b = 3;

  • double h = 92;

MCQ
Advertisements

Solution

long g = 65.8;

Explanation:

Tries to assign a decimal value (which Java treats as a float) to a long integer variable. Because a long can only store whole numbers, this causes a compile-time type mismatch error due to a loss of precision.

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. (vi) | Page 64
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×