It's not a secret anymore!
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
JavaRanch » Java Forums » Java » Java in General
Bookmark "runtime information for a class" Watch "runtime information for a class" New topic

runtime information for a class

Arun Martin
Ranch Hand

Joined: Dec 01, 2000
Posts: 64
To access runtime type information for a class, array, or primitive datatype, you can use the _________ class.
Ajith Kallambella

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.

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.

SCJP 1.5, SCEA, ICED (287,484,486)
I agree. Here's the link:
subject: runtime information for a class
It's not a secret anymore!