here's example:
you have to downcast.Code:long longnumber = 100; int a = (int) longnumber;
|
.\server\players\client.java:7957: inconvertible types
found : long
required: java.lang.Integer
int a2 = (Integer) number;God, this is tricky.case 60://Ting.
long number = inStream.readQWord();
int a2 = (Integer) number;
diceRoll(a2, 0);
break;
REP++
here's example:
you have to downcast.Code:long longnumber = 100; int a = (int) longnumber;
int a = (Integer) long;
I don't think the (int) cast works when casting on objects like that >.>
.\server\players\client.java:7957: inconvertible types
found : long
required: java.lang.Integer
int a2 = (Integer) number;God, this is tricky.case 60://Ting.
long number = inStream.readQWord();
int a2 = (Integer) number;
diceRoll(a2, 0);
break;
Lol...
long nameOfLong = 123456;
int newInteger = nameOfLong.intValue();
^Code:.\server\players\client.java:7968: long cannot be dereferenced int a2 = number.intValue();
You might be confused if you're converting from Long/Integer because of autoboxing where you can interchange them. Beware thouh, Integer is a slow object unlike int and must be converted even if you use it as:
int i = new Integer(0);
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |