getDeclaredMethod1
Objective
  • get a declared method only
complete code :

/**
* This is Template 1 Work place
*/



/**
* @author Manas9

*
*/
import java.io.*;
import java.lang.reflect.*;
import java.net.InetAddress;
public class ClassTemplate1 {
/**
*
*/
public ClassTemplate1() {// TODO Auto-generated constructor stub
}
public static void main( String[] args )throws IOException
{
System.out.println("----");
try
{
Class<?> cls = Class.forName("Process");
Method md = (Method) cls.getDeclaredMethod("show");
System.out.println(md);
}
catch(Exception e)
{ e.printStackTrace();}
}
}
//
class Process{
Process() {System.out.println("Constructor Invoked"); }
public void show(){}
void display(){}
}