java interview question and answer| Data type

preview_player
Показать описание
java interview question
#shorts #interview #interviewquestions #datatypesinjava
#programming
#javaprogramming
#javaprogrammingtutorial
#automation
#qa
#qaautomation
#automationtester
#automationteating
Рекомендации по теме
Комментарии
Автор

C.E because compiler thinks that a and b are int values if u write( byte)a+b..if give run time exception

satyamanda
Автор

Int + int is always int and cannot be stored in byte

namanmishra
Автор

Your explanation is not correct. It's not about range. If you use
byte a = 1;
byte b = 1;
byte c = a + b;
it still shows compilation error. Because byte, char and short, any binary operation will convert to int.

manomitmitra