Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get Class of primitive datatypes array . Class.forName(int[]) throws exception

 
Aruna Agrawal
Ranch Hand
Posts: 66
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all
Class.forName(int[]) throws exception ClassNotFound Exception. I need to Class instance of primitive types . How do i do it?
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try int[].class

Dave
 
Nischal Topno
Ranch Hand
Posts: 45
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
primitives is not an object, hence you cannot get a class from int. If you looking at primitve wrappers then it's the Integer class that you require.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Interestingly, it looks like this may also work, but confuse the heck out of anyone who has to support it:
 
Aruna Agrawal
Ranch Hand
Posts: 66
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks ..
[B for byte array
[I for int array
[F for float array etc works fine
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
int[].class didn't work?
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I really recommend using int[], I really do. Anyone looking at the code after this won't have any idea what "[I" is. They may even slap you in the street
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic