This section illustrates how to retrieve an object name that reflects the package name by using the object.getClass() method. Here is an example that provides the proper usage of the object.getClass() method in more detail.
Finding out the object of the class
This section illustrates how to
retrieve an object name that reflects the package name by using the
object.getClass() method. Here is an example that provides the
proper usage of the object.getClass() method in more detail.
Create a class "Fobject" with an object Checkbox. Now retrieve
an object name that reflects the package name by
using the object.getClass() method.
Here is the code of the Example :
Fobject.java:
import java.lang.reflect.*;
|
Here is the output of the Example :
C:\roseindia>javac Fobject.java C:\roseindia>java Fobject java.awt.Checkbox |