Click here to watch in Youtube :
https://www.youtube.com/watch?v=szBf8LkhM-Y&list=UUhwKlOVR041tngjerWxVccw
DisplayMessage.java
https://sites.google.com/site/ramj2eev1/home/javabasics/ReflectionDemo_method_paramcount.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/ReflectionDemo_method_paramcount
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/35f19409ce262cff1a4ed631c9adc6ca413c2cb0/BasicJava/ReflectionDemo_method_paramcount/?at=master
See also:
All JavaEE Viedos Playlist
All JavaEE Viedos
All JAVA EE Links
Servlets Tutorial
All Design Patterns Links
JDBC Tutorial
Java Collection Framework Tutorial
JAVA Tutorial
Kids Tutorial
https://www.youtube.com/watch?v=szBf8LkhM-Y&list=UUhwKlOVR041tngjerWxVccw
DisplayMessage.java
class DisplayMessage { public void displayMessage(String message) { System.out.println(message); } }ReflectionDemo.java
import java.lang.reflect.Method; /** * * How to get method parameter count. * */ public class ReflectionDemo { public static void main(String[] args) { Class<DisplayMessage> classObj = DisplayMessage.class; Method[] methodArray = classObj.getMethods(); for (Method method : methodArray) { System.out.println(method); System.out.println("Parameter Count = "+method.getParameterCount()); System.out.println("---------------------------"); } } }Output
public void DisplayMessage.displayMessage(java.lang.String) Parameter Count = 1 --------------------------- public final void java.lang.Object.wait() throws java.lang.InterruptedException Parameter Count = 0 --------------------------- public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException Parameter Count = 2 --------------------------- public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException Parameter Count = 1 --------------------------- public boolean java.lang.Object.equals(java.lang.Object) Parameter Count = 1 --------------------------- public java.lang.String java.lang.Object.toString() Parameter Count = 0 --------------------------- public native int java.lang.Object.hashCode() Parameter Count = 0 --------------------------- public final native java.lang.Class java.lang.Object.getClass() Parameter Count = 0 --------------------------- public final native void java.lang.Object.notify() Parameter Count = 0 --------------------------- public final native void java.lang.Object.notifyAll() Parameter Count = 0 ---------------------------Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/ReflectionDemo_method_paramcount.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/ReflectionDemo_method_paramcount
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/35f19409ce262cff1a4ed631c9adc6ca413c2cb0/BasicJava/ReflectionDemo_method_paramcount/?at=master
See also:
No comments:
Post a Comment