File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

array store exception

 
gurpreet singh
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello frnds,

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

but
String[] objArr = new String[10];
objArr[0] = new Long(); // gives compile time exception
 
Dan Polak
Ranch Hand
Posts: 32
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Long IS A Object, but Long IS NOT A String
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic