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
What's a method in programming?
Why is sizeof not a function?
What is meant by class loader? How many types are there?
What are advantages of using Java?s layout managers than windowing systems?
What is an enumeration?
If I only change the return type, does the method become overloaded?
What are the main differences between notify and notifyAll in Java?
Why do we need strings in java?
What is a generic data type?
Does java allow default arguments?
What is local class in java?
How to perform quicksort in java?
How many types of assembly languages are there?
Using callable statement how can you pass out parameters, explain with example?
What is the range of the short type?