3/31 how can i tell whether a Java object is an array?
ie applet.getClass().toString() -> java.applet.Applet
(new int[] { 1, 2, 3 }).getClass() -> ?
\_ Arrays aren't objects, they are primitive types. Your question
betrays a serious lack of understanding of what an object is, and
an array is. I hope you haven't graduated.
\_ Your reply betrays a serious lack of experience programming
in Java, Java isn't my first choice, but that's like one
of the first principles you learn coding in it.
\_ "Java arrays are objects" -- the opening words of Chapter 10,
Arrays, in the Java Language Spec.
\_ nevertheless, you can do:
1) (new int[] { 1, 2, 3 }).getClass()
2) Object o = (new int[] { 1, 2, 3 })
3) BUT NOT Object o = 1
so its not an object... ??? :p
go read: http://www7.software.ibm.com/vad.nsf/Data/Document2712
and you'll see the reason for the question.
its a big kludge by Sun
\_ array.getClass().isArray() -> true
hope you haven't graduated either ;p
\_ the String class supports '+' and '+='
\_ that's just syntatic sugar,
but object vs primitive in Java is a Real Big Mess(TM)
\_ "Java=C++--" - Bill Joy
\_ GO Smalltalk!!! -purist
\_ PERL 5.6!!!
\_ ED! ED is the Standard Language!
\_ so how can you tell if an ED! object is
an array?
\_ Its all just memory anyway, just toggle
the right bits in RAM. How hard is that?
(Not hard at all, if you have ED fu!)
\_ It's easy in PERL.
\_ This thread looks similar to
Bresenham's algorithm.
\_ I wrote that in PERL with
ED once, just for kicks.
\_ NO, WINDOWS. WINDOWS IS
THE STANDARD EVERYTHING.
\_ Microsoft invented
the Internet.
\_ I heard that BG
wrote PERL with an
early version of
ED.
\_ cool.
\_ NO, MAC OS X WILL SQUASH
WINDOZE SOON. LONG
LIVE APPLE-NeXT
\_ NO, WINDOWS. WINDOWS
EATS EVERYTHING FOR
BREAKFAST. IT IS THE
SOLUTION TO ALL YOUR
PROBLEMS. NEED AN
ABORTION? WINDOWS
WILL TAKE CARE OF IT.
NEED TO HAVE YOUR CAR
FIXED. WINDOWS WILL
TAKE CARE OF IT. BILL
GATES IS MY GOD.
\_ NEGATIVE...THE
NEW HYBRID OF UNIX
AND THE MAC OS WILL
TURN THE TIDE IN
IN THE MAC/PC WARS
FOR YEARS TO COME.
MACS WILL NO LONGER
JUST LOOK GOOD...
THEY WILL ESTABLISH
A NEW PARADIGM IN
PERSONAL COMPUTING.
STEVE JOBS, THE
SMELLY-ASSHOLE,
DAUGHTER-DUMPING,
"REALITY DISTORTION
FIELD MAN" IS THE
TRUE MESSIAH WHO
WILL RESTORE
BALANCE TO THE
FORCE. REMEMBER:
THERE CAN ONLY
BE ONE. |