import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class Main {
public static void main(String[] args) {
Method[] methods = String.class.getDeclaredMethods();
Field[] Fields = String.class.getDeclaredFields();
for (Method method:methods) {
System.out.print(method.getName());
System.out.print("-");
System.out.println(method.getGenericReturnType().getTypeName());
}
System.out.println("==========================================");
for (Field field:Fields) {
System.out.println(field.getName());
System.out.print("-");
System.out.println(field.getGenericType().getTypeName());
}
}
}
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class Main {
public static void main(String[] args) {
String x = "123";
Method[] methods = x.getClass().getDeclaredMethods();
Field[] Fields = x.getClass().getDeclaredFields();
for (Method method:methods) {
System.out.print(method.getName());
System.out.print("-");
System.out.println(method.getGenericReturnType().getTypeName());
}
System.out.println("==========================================");
for (Field field:Fields) {
System.out.println(field.getName());
System.out.print("-");
System.out.println(field.getGenericType().getTypeName());
}
}
}