aspose file tools*
The moose likes Beginning Java and the fly likes Adding bytes and getting int Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Adding bytes and getting int" Watch "Adding bytes and getting int" New topic
Author

Adding bytes and getting int

Prakash Rai
Ranch Hand

Joined: Jan 10, 2011
Posts: 106


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: 106

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: 40064
    
  28
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Adding bytes and getting int