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
Does java support Operator Overloading?
Can we pass a primitive type by reference in java? How
What is the difference between post and put?
What is role of void keyword in declaring functions?
What do you mean by buffering?
Is java 9 released?
What does || mean in vectors?
What is a blocking method in Java?
What do you meant by active and passive objects?
How do you declare a string variable?
What is Mutex (Mutual Exclusion Object) ?
How is treeset implemented in java?
What is the difference amongst jvm spec, jvm implementation, jvm runtime ?
Does constructor be static?
What are functions in java?