Considering these variable declarations, which of the following statements are correct?

byte b = 1;
char c = 1;
short s = 1;
int i = 1;
1. In operations with two operands both are promoted to the most broad of their types. Therefore, result will have that most broad type.
2. In Java Virtual Machine it is impossible to add something to byte variable without promoting byte to int. It is also true for char type.
3. But += and <<= operations will be successful as they implicitly do type conversion.

Слідкуй за CodeGalaxy

Мобільний додаток Beta

Get it on Google Play
Зворотній Зв’язок
Продовжуйте вивчати
тести з Java
Зареєструйся Зараз
або Підпишись на майбутні тести