Which code fragment cause a compilation error?

Which code fragment cause a compilation error?
A. flat flt = 100F;
B. float flt = (float) 1_11.00;
C. float flt = 100;
D. double y1 = 203.22;
floatflt = y1
E. int y2 = 100;
floatflt = (float) y2;

Download Printable PDF. VALID exam to help you PASS.

One thought on “Which code fragment cause a compilation error?

  1. D is the correct answer.

    Even after the code is corrected to:

    double y1 = 203.22;
    float flt = y1;

    The code still produces the following compilation error:
    Type mismatch: cannot convert from double to float

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.