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 int getRIdFromName(Class<?> cls, String filedName) {
        try {
            Field f = cls.getField(filedName);
            return Integer.parseInt(f.get(null).toString());
        } catch (Exception e) {
            e.printStackTrace();
        }

        return 0;
    }
}