Reflection

Reflection API Code Samples

The Reflection API represents or reflects the classes, interfaces, and objects in the Java virtual machine. (JVM 1).

  • Arrays
  • Examining Classes
  • Manipulating Objects
Arrays
  • array2.java creates a 10-long array of Strings and sets location 5 in the array to a string value. The value is retrieved and displayed. For supporting information see Using Java Reflection.
Examining Classes
Manipulating Objects
  • Method interposing example shows how to use the common interface provided by the Proxy class to encode and dispatch a method invocation to another object.
  • constructor2.java finds a constructor that handles the specified parameter types and invokes it to create a new instance of the object. For supporting information see Using Java Reflection.

1 As used on this web site, the terms Java virtual machine or JVM mean a virtual machine for the Java platform.


Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

Sign up or Log in to add a comment or watch this page.


The individuals who post here are part of the extended Sun Microsystems community and they might not be employed or in any way formally affiliated with Sun Microsystems. The opinions expressed here are their own, are not necessarily reviewed in advance by anyone but the individual authors, and neither Sun nor any other party necessarily agrees with them.

Copyright 1994-2009 Sun Microsystems, Inc.
Powered by Atlassian Confluence
Sun Guidelines on Public Discourse Privacy Policy Terms of Use Trademarks Site Map Employment Investor Relations Contact