Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

solve this is my problem byte a=40,byte b=50 both add value is 90 this is with in range of byte... byte range is -128to 127....
why this pgm gives error like type mismatch....




package javapgms;




public class byte1 {

public static void main(String args[])
{
byte a=40,b=50;
byte c=a+b;

System.out.println(c);
}




}
note : dont use int k...
a,b,c are in byte range... mind it..

Answer Posted / siva

c=(byte)(a+b);

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Does java support Operator Overloading?

1041


Can we pass a primitive type by reference in java? How

933


What is the difference between post and put?

1066


What is role of void keyword in declaring functions?

1050


What do you mean by buffering?

1045


Is java 9 released?

1006


What does || mean in vectors?

931


What is a blocking method in Java?

1240


What do you meant by active and passive objects?

1084


How do you declare a string variable?

1017


What is Mutex (Mutual Exclusion Object) ?

1152


How is treeset implemented in java?

1027


What is the difference amongst jvm spec, jvm implementation, jvm runtime ?

968


Does constructor be static?

1035


What are functions in java?

950