[ale] OT, but not as OT as recent stuff (JAVA)
Brian
brianb_ale at yahoo.com
Thu Oct 31 16:34:54 EST 2002
--- Geoffrey <esoteric at 3times25.net> wrote:
> Okay Java gurus, I've come to the conclusion Java
> was designed to drive
> you insane whenever you need to convert types. I'm
> trying to take two
> java.lang.Objects which are a series of numbers
> subtract one from the
> other and store the result in a long value. I've
> tried:
>
(long)theObject // Won't work, cant cast between
primitives and objects
(Long)theObject // Nope
Long.parseLong(theObject) // Works for String
objects. Expects a String object parameter.
Assuming you're using the Wrapper Classes for Long,
etc., you can assign the difference of these two
objects to a primitive type by:
(ie.
Long objLong = new Long(15);
Integer objInt = new Integer(10);
long lng = (long)(objLong.longValue() -
objInt.intValue());
I'm not sure if this answers your question.
__________________________________________________
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/
---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be
sent to listmaster at ale dot org.
More information about the Ale
mailing list