Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.lang.reflect.Field;

public class Main {
    public static Field[] findFields(Class<?> clazz) {
        Field[] result = null;
        if (clazz != null) {
            result = clazz.getDeclaredFields();
        }
        return result;
    }

    public static Field findFields(Class<?> clazz, String fieldName) {
        Field result = null;
        if (clazz != null) {
            try {
                result = clazz.getField(fieldName);
            } catch (NoSuchFieldException e) {
                e.printStackTrace();
            }
        }
        return result;
    }
}