Y
yair
hey
I wrote this piece of code:
1 : import java.util.Vector;
2 :
3 : public class Try1 {
4 : public static void main(String args[]) {
5 : Vector vec = new Vector();
6 : vec.add(new Byte((byte)27));
7 : byte b = ((Byte) vec.elementAt(0)).byteValue() + (byte)3;
8 : System.out.println(b);
9 : }
10: }
javac will not compile this code, because it sais:
If i'll cast to byte it will be compiled:
byte b = (byte) (((Byte) vec.elementAt(0)).byteValue() + (byte)3);
y isn't it working in the original form? I dont c any hidden casting
from byte to int.
thanks
yair
I wrote this piece of code:
1 : import java.util.Vector;
2 :
3 : public class Try1 {
4 : public static void main(String args[]) {
5 : Vector vec = new Vector();
6 : vec.add(new Byte((byte)27));
7 : byte b = ((Byte) vec.elementAt(0)).byteValue() + (byte)3;
8 : System.out.println(b);
9 : }
10: }
javac will not compile this code, because it sais:
If i'll cast to byte it will be compiled:
byte b = (byte) (((Byte) vec.elementAt(0)).byteValue() + (byte)3);
y isn't it working in the original form? I dont c any hidden casting
from byte to int.
thanks
yair