What will be the output of the following code
char ch = ‘E’;
int x=(int)ch+2;
y=x+(float)ch;
System.out.println(x++);
System.out.println(++y);
Answers
Answered by
2
First of all
y is not declared
If you declare y as float then OUTPUT is
71
141.0
If you declare y as int then you have to add cast to int OUTPUT is
71
141
Similar questions