This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
In Java, an Monkey array can be assigned to an animal array.
The following code is legal:
Java doesn't allow this, however. Why? Is "Object" a special case?
SCJP 1.4 - 95%
Andy Morris
Ranch Hand
Joined: May 30, 2004
Posts: 78
posted
0
Both code snippets are completely legal and will compile and run without errors. I don't know how you reached your observation.
The only arrays where implicit casting is not permitted are arrays referencing primitives types.
Barry Gaunt
Ranch Hand
Joined: Aug 03, 2002
Posts: 7729
posted
0
Originally posted by Andy Morris: Both code snippets are completely legal and will compile and run without errors. I don't know how you reached your observation.
The only arrays where implicit casting is not permitted are arrays referencing primitives types.
I had created a class called "Object" in my own package. I know this is stupid, but I wanted to see (with my own eyes) that a class called "Object" would compile and extend "java.lang.Object".