Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.lang.reflect.Field;
import java.util.ArrayList;

public class Main {
    public static void main(String[] st) throws Exception {
        Private p = new Private();
        Field[] fs = p.getClass().getDeclaredFields();
        for (Field f : fs) {
            f.setAccessible(true);
            System.out.println(f.get(p));
        }
    }
}

class Private {
    private int i = 20;
    public String s = "java";
    private String name = "Object";
    private ArrayList<String> list = new ArrayList<String>() {
        {
            add("A");
            add("B");
        }
    };
}