Java Reflection for Dynamic Behavior


Use Java Reflection API to inspect or modify runtime attributes of classes, methods, and fields dynamically.

Source Code

Class objClass = Class.forName("java.lang.String");
Method[] methods = objClass.getMethods();
System.out.println(Arrays.toString(methods)); // Prints all methods in the String class
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments