aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes array store exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "array store exception" Watch "array store exception" New topic

array store exception

gurpreet singh
Ranch Hand

Joined: Apr 07, 2006
Posts: 38
Hello frnds,

pls explain why does
Object[] objArr = new String[10];
objArr[0] = new Long(); // compiles; fails at runtime

String[] objArr = new String[10];
objArr[0] = new Long(); // gives compile time exception

Dan Polak
Ranch Hand

Joined: Nov 06, 2006
Posts: 32
Long IS A Object, but Long IS NOT A String

<a href="" target="_blank" rel="nofollow"></a>
Have you tried LearnNowOnline?
subject: array store exception