Multiple Choice Question

Quiz Guidelines

 

QID: 
130
Question: 

What will be the result of attempting to compile and run the following code?

public class PromotionTest{
public static void main(String args[]){
int i = 5;
float f = 5.5f;
double d = 3.8;
char c = 'a';
if (i == f) c++;
if (((int) (f + d)) == ((int) f + (int) d)) c += 2;
System.out.println(c);
}
}

Select 1 option

A. The code will fail to compile.
B. It will print d.
C. It will print c.
D. It will print b
E. It will print a.

Q&A Set: