import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.Class;
import java.lang.reflect.Method;
public class Temp{
public Temp(){
try{
init();
}catch(Exception ee){ee.printStackTrace();}
}
public static void main(String []args){
new Temp();
}
public void init()throws Exception{
System.out.println("Enter the clas name:");
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
String name=in.readLine();
Class c=Class.forName(name);
Method[] m=c.getMethods();
for(int n=0;n
System.out.println(m[n].toString());
}
}
}
[lefteye@localhost program]$ java Temp
Enter the clas name:
java.lang.Class
public native boolean java.lang.Class.isInstance(java.lang.Object)
public native int java.lang.Class.getModifiers()
public static java.lang.Class java.lang.Class.forName(java.lang.String) throws java.lang.ClassNotFoundException
public static java.lang.Class java.lang.Class.forName(java.lang.String,boolean,java.lang.ClassLoader) throws java.lang.ClassNotFoundException
public java.lang.String java.lang.Class.getName()
public java.lang.String java.lang.Class.toString()
public boolean java.lang.Class.desiredAssertionStatus()
public java.lang.ClassLoader java.lang.Class.getClassLoader()
public java.lang.Class[] java.lang.Class.getClasses()
public native java.lang.Class java.lang.Class.getComponentType()
public java.lang.reflect.Constructor java.lang.Class.getConstructor(java.lang.Class[]) throws java.lang.NoSuchMethodException,java.lang.SecurityException
public java.lang.reflect.Constructor[] java.lang.Class.getConstructors() throws java.lang.SecurityException
public java.lang.Class[] java.lang.Class.getDeclaredClasses() throws java.lang.SecurityException
public java.lang.reflect.Constructor java.lang.Class.getDeclaredConstructor(java.lang.Class[]) throws java.lang.NoSuchMethodException,java.lang.SecurityException
public java.lang.reflect.Constructor[] java.lang.Class.getDeclaredConstructors() throws java.lang.SecurityException
public java.lang.reflect.Field java.lang.Class.getDeclaredField(java.lang.String) throws java.lang.NoSuchFieldException,java.lang.SecurityException
public java.lang.reflect.Field[] java.lang.Class.getDeclaredFields() throws java.lang.SecurityException
public java.lang.reflect.Method java.lang.Class.getDeclaredMethod(java.lang.String,java.lang.Class[]) throws java.lang.NoSuchMethodException,java.lang.SecurityException
public java.lang.reflect.Method[] java.lang.Class.getDeclaredMethods() throws java.lang.SecurityException
public native java.lang.Class java.lang.Class.getDeclaringClass()
public java.lang.reflect.Field java.lang.Class.getField(java.lang.String) throws java.lang.NoSuchFieldException,java.lang.SecurityException
public java.lang.reflect.Field[] java.lang.Class.getFields() throws java.lang.SecurityException
public native java.lang.Class[] java.lang.Class.getInterfaces()
public java.lang.reflect.Method java.lang.Class.getMethod(java.lang.String,java.lang.Class[]) throws java.lang.NoSuchMethodException,java.lang.SecurityExceptionpublic java.lang.reflect.Method[] java.lang.Class.getMethods() throws java.lang.SecurityException
public java.lang.Package java.lang.Class.getPackage()
public java.security.ProtectionDomain java.lang.Class.getProtectionDomain()
public java.net.URL java.lang.Class.getResource(java.lang.String)
public java.io.InputStream java.lang.Class.getResourceAsStream(java.lang.String)public native java.lang.Object[] java.lang.Class.getSigners()
public native java.lang.Class java.lang.Class.getSuperclass()
public native boolean java.lang.Class.isArray()
public native boolean java.lang.Class.isAssignableFrom(java.lang.Class)
public native boolean java.lang.Class.isInterface()
public native boolean java.lang.Class.isPrimitive()
public java.lang.Object java.lang.Class.newInstance() throws java.lang.InstantiationException,java.lang.IllegalAccessException
public native int java.lang.Object.hashCode()
public final native java.lang.Class java.lang.Object.getClass()
public final void java.lang.Object.wait() throws java.lang.InterruptedException
public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException
public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException
public boolean java.lang.Object.equals(java.lang.Object)
public final native void java.lang.Object.notify()
public final native void java.lang.Object.notifyAll()