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

What are the types of exceptions?

1104


What is thread pool? How can we create thread pool in java?

1135


How big is a 32 bit integer?

1096


Why do we need data serialization?

1040


What is local declaration?

1034


How to make a write-only class in java?

1103


What is data and its types?

1049


Explain polymorphism citing an example.

1100


What is the meaning of flag day?

1082


Does apple use java?

1000


String and stringbuffer both represent string objects. Can we compare string and stringbuffer in java?

1027


How static variable work in java?

1191


What are different types of references?

1024


Give the hierarchy of inputstream and outputstream classes.

1158


What is a method signature java?

1108