Hi Friends,
Please clear my dbt i have with Selection statements in
java. Please look at the below lines of code.
Byte b = 5;
final byte i =10;
switch(b){
case i:
break;
case 3: //compilation error
break;
}
For the above code i am getting the compilation error( at case 3
as
cannot covert from int to Byte. .Here the value 3 converts to Integer object type and trys to assign that to b.
Is my assumption correct?
If i change the type of b from Byte to byte it compiles fine.
byte b = 5;
final byte i =10;
switch(b){
case i:
break;
case 3:
break;
}
Can you please clarify...
Thanks,
Ravindra.