Hi everybody,
This is aditya makam. I am a new member of this group. I hope u ppl help me. Here is my doubt.
In
java if you compile the following code.
class ByteTest {
public static void main (
String args [ ] ) {
ByteTest t = new ByteTest(10);
}
};
It will give CompileTime error.Because compiler is thinking that 10 is an int literal,but in Byte class only two constructors are there which take arguments as byte ,String.But if consider the following code,
class ByteTest1 {
public static void main ( String args [ ] ) {
byte b =10;
System.out.println(b);
}
};
It will get compiled and will print 10 as output.
My doubt is ,here also 10 is an integer literal and we are trying to store in byte variable.But it is not giving compile time error.Why is it so?
Plz anybody who can explain plz give me reply...to this message.
yours friendly
aditya