Which of the next lines compile without an error?
Explanation
Line float f = 7.0; will not compile because the type of a floating-point constant in java is double. This will compile:
float f = (float) 7.0; or float f = 7.0f;
Line char c = "z"; will not compile because char constant is defined with single quotes. This will compile char c = 'z';
Line byte b = 255; will not compile because the byte type can only hold integers between –128 and +127;
boolean type value can only be true or false.
int j = 'z'; will compile because chars can be automatically casted to an int.

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Продолжайте изучать
тесты по Java
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты