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.List;

public class Main {
    private static void addFields(Class<?> clazz, List<Field> list) {
        for (Field f : clazz.getFields()) {
            list.add(f);
        }
        Class<?> superClass = clazz.getSuperclass();
        if (superClass != null) {
            addFields(superClass, list);
        }
    }
}