| Author |
Adding bytes and getting int
|
Prakash Rai
Ranch Hand
Joined: Jan 10, 2011
Posts: 101
|
|
Q1. If we are adding byte and byte then it should also result byte but it is int. Why?
|
 |
Abhijeet Sutar
Greenhorn
Joined: Feb 28, 2010
Posts: 17
|
|
@Somprakash Rai
First,
Next time, Whenever you want to ask new question, start in new topic.
Second,answer to above question,Whenever the byte ,short and char type variables used in the expression like above one ,addition , those variables are promoted to int type
|
OCPJP 6 93%
|
 |
Prakash Rai
Ranch Hand
Joined: Jan 10, 2011
Posts: 101
|
|
Abhijeet Sutar wrote:@Somprakash Rai "I think I have started Java Basic topic and all these question comes under this topic so I have posted . "
First,
Next time, Whenever you want to ask new question, start in new topic.
Second,answer to above question,Whenever the byte ,short and char type variables used in the expression like above one ,addition , those variables are promoted to int type
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32654
|
|
Abhijeet Sutar wrote: . . . Whenever you want to ask new question, start in new topic. . . .
Agree. We have a relatively new feature, which allows me to make the new posts into a new topic.
Voilà!
And I think you have given a sufficient answer.
|
 |
 |
|
|
subject: Adding bytes and getting int
|
|
|