Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.lang.reflect.Field;

import java.util.ArrayList;

public class Main {

    public static ArrayList<String> getFields(Class<?> cls) {
        ArrayList<String> fieldList = new ArrayList<String>();
        Field[] fields = cls.getDeclaredFields();
        for (Field f : fields) {
            fieldList.add(f.getName());
        }
        return fieldList;
    }
}