• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Adding bytes and getting int

 
Prakash Rai
Ranch Hand
Posts: 106
Eclipse IDE MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Q1. If we are adding byte and byte then it should also result byte but it is int. Why?
 
Abhijeet Sutar
Greenhorn
Posts: 17
Android Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@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
 
Prakash Rai
Ranch Hand
Posts: 106
Eclipse IDE MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 49796
69
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic