HTML5 Canvas
Written by: Simon Sarris
Featured Refcardz: Top Refcardz:
  1. Apache Hadoop
  2. Web Driver
  3. MVVM
  4. REST
  5. ADO.NET
  1. HTML5
  2. Ajax
  3. jQuery Selectors
  4. CSS Part 1
  5. Git

Link Details

Link 110310 thumbnail
User 131196 avatar

By jj83777
via tutorials.jenkov.com
Published: Sep 04 2008 / 06:44

Text no. 11 in the Java Reflection series describes how to create and access arrays via Java Reflection. Especially obtaining the class object of an array via reflection can be tricky, if you don't know how.
  • 15
  • 0
  • 1619
  • 2

Comments

Add your comment
User 131196 avatar

Jakob Jenkov replied ago:

0 votes Vote down Vote up Reply

Forget the link above... it points to localhost... suprising that Dzone doesn't detect that. Here is the real link:

http://tutorials.jenkov.com/java-reflection/arrays.html

User 111696 avatar

bloid replied ago:

0 votes Vote down Vote up Reply

this one's fixed now

User 131196 avatar

Jakob Jenkov replied ago:

0 votes Vote down Vote up Reply

except the dzone URL is off... java_reflection_tutorial_introduction.html

User 131196 avatar

Jakob Jenkov replied ago:

0 votes Vote down Vote up Reply

except the dzone URL is off... java_reflection_tutorial_introduction.html

User 191349 avatar

raveman replied ago:

0 votes Vote down Vote up Reply

nice find, but its useless? i would use list.

User 131196 avatar

Jakob Jenkov replied ago:

0 votes Vote down Vote up Reply

I would use List too in most cases, when I can. But you can't always make that choice yourself, can you? For instance, when configuring an app via DI, sometimes you have to inject arrays into some classes that you did not write yourself.

User 297233 avatar

eyal.lupu replied ago:

0 votes Vote down Vote up Reply

Nice post, just a comment: There is a way to access natives array classes using reflection. I wrote a short follow up about it in my blog: http://www.jroller.com/eyallupu/entry/two_side_notes_about_arrays

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.