You can use reflect.
import java.lang.reflect.Field;
//...
SomeClass targetClass = new SomeClass();
for(Field field : targetClass.getClass().getDeclaredFields()){
System.out.println(field.getType()+" "+field.getName());
}
You can do it.
© 2024 OneMinuteCode. All rights reserved.