[2376] in java-interest
casting
daemon@ATHENA.MIT.EDU (Laura Lemay, Killer of Trees)
Sat Sep 30 03:59:40 1995
Date: Thu, 28 Sep 1995 12:10:55 -0800
To: java-interest@java@sun.com
From: lemay@lne.com (Laura Lemay, Killer of Trees)
I'm onto casting now....
I've managed to explicitly cast between objects of my own making with
no problem. I've managed to cast ints to floats and between other
base types.
My next plan was simply to cast an int to its "wrapper" equivalent:
Integer t = (Integer) 5;
Nope. Compiler error. Invalid cast.
Am I right in coming to the conclusion that one has to use new Integer(5)
to get an Integer object, instead of casting? Does that imply you
can't cast between the base types and objects at all?
Laura
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com