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
Зарегистрируйся сейчас
или Подпишись на будущие тесты