See if field exists in class

后端 未结 6 1808
眼角桃花
眼角桃花 2021-02-03 21:47

I have a class with various variables

public class myClass{

    public int id;
    public String category;
    public String description;
    public String star         


        
6条回答
  •  梦毁少年i
    2021-02-03 22:29

    What you are looking for is called "Reflection". It provides the ability at run-time to determine what fields and methods are contained within a class.

    http://today.java.net/pub/a/today/2008/02/12/reflection-in-action.html

提交回复
热议问题