Oracle
1Z0-803 · Question #101
1Z0-803 Question #101: Real Exam Question with Answer & Explanation
The correct answer is D: double y1 = 203.22;. Exception in thread "main" java.lang.Error: Unresolved compilation problem: Type mismatch: cannot convert from double to float
Question
Which code fragment cause a compilation error?
Options
- Afloat flt = 100F;
- Bfloat flt = (float) 1_11.00;
- Cfloat flt = 100;
- Ddouble y1 = 203.22;
- Eint y2 = 100;
Explanation
Exception in thread "main" java.lang.Error: Unresolved compilation problem: Type mismatch: cannot convert from double to float
Community Discussion
No community discussion yet for this question.