Reflection_getDeclaredMethods1
Objectives
  • getDeclaredMethod()
  • getMethod()
  •  getDeclaredMethods()
    throws SecurityException
Complete Code :

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[] = cls.getDeclaredMethods();
for(int i=0; i< md.length; i++ )
{ System.out.println(md[i]); }
}
catch(Exception e)
{ e.printStackTrace();}
}
}
//
class Process{
Process() {System.out.println("Constructor Invoked"); }
public void show(){}
void display(){}
}