Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.lang.reflect.Field;

public class Main {

    public static void main(String[] args) throws Exception {

        Class cls = Class.forName("java.lang.String");
        System.out.println("Fields =");

        // returns the array of Field objects representing the public fields
        Field f[] = cls.getFields();
        for (int i = 0; i < f.length; i++) {
            System.out.println(f[i]);
        }

    }
}