How to Get All Method Names from Class in Java

Get All Method Names in Java

In this program, We will show you how to get all method names from class in Java. The example program has been tested and output were shared in the same post.

1) Input POJO (Plain Old Java Object) class

2) Retrieving Method Names from Class

Output

————————————-
Printing Method Names
————————————-
setCustId
getCustName
setCustName
getCustAge
setCustAge
getCustId
getCustAddress
setCustAddress
getClass
hashCode
equals
toString
notify
notifyAll
wait
wait
wait
————————————-
Printing Complete Method Signature
————————————-
public void com.dineshkrish.Customer.setCustId(int)
public java.lang.String com.dineshkrish.Customer.getCustName()
public void com.dineshkrish.Customer.setCustName(java.lang.String)
public int com.dineshkrish.Customer.getCustAge()
public void com.dineshkrish.Customer.setCustAge(int)
public int com.dineshkrish.Customer.getCustId()
public java.lang.String com.dineshkrish.Customer.getCustAddress()
public void com.dineshkrish.Customer.setCustAddress(java.lang.String)
public final native java.lang.Class java.lang.Object.getClass()
public native int java.lang.Object.hashCode()
public boolean java.lang.Object.equals(java.lang.Object)
public java.lang.String java.lang.Object.toString()
public final native void java.lang.Object.notify()
public final native void java.lang.Object.notifyAll()
public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException
public final void java.lang.Object.wait() throws java.lang.InterruptedException
public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException

References

1. Java Method Reflection API