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 are the types of exceptions?
What is thread pool? How can we create thread pool in java?
How big is a 32 bit integer?
Why do we need data serialization?
What is local declaration?
How to make a write-only class in java?
What is data and its types?
Explain polymorphism citing an example.
What is the meaning of flag day?
Does apple use java?
String and stringbuffer both represent string objects. Can we compare string and stringbuffer in java?
How static variable work in java?
What are different types of references?
Give the hierarchy of inputstream and outputstream classes.
What is a method signature java?