This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes runtime information for a class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "runtime information for a class" Watch "runtime information for a class" New topic
Author

runtime information for a class

Arun Martin
Ranch Hand

Joined: Dec 01, 2000
Posts: 64
hi,
To access runtime type information for a class, array, or primitive datatype, you can use the _________ class.
ClassLoader
Class
System
Object
Runtime
arun.
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
The answer is "Class" class. This is a part of Java introspection facility using which you can retrieve the metadata a class is made of like names of methods, constructors, fields, their types etc.
Using the retrieved information, you can go one step further and invoke methods using dynamic dispatch.
Ajith


Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
Anil Vupputuri
Ranch Hand

Joined: Oct 31, 2000
Posts: 527
From JDK1.2, Java supports Reflection API,which is powerful
Using Reflection,enables Java code to discover information about the fields, methods and constructors of loaded classes, and to use reflected fields, methods, and constructors to operate on their underlying counterparts on objects, within security restrictions. The API accommodates applications that need access to either the public members of a target object (based on its runtime class) or the members declared by a given class.
Anil

SCJP 1.5, SCEA, ICED (287,484,486)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: runtime information for a class
 
Similar Threads
Heap Size of the JVM
How to execute a CLI command from Java program
Deserialize object - Class unknown
How the Annotations are Processed?
Container information at runtime