Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.lang.reflect.Constructor;

public class Main {

    public static void main(String[] args) {

        MyClass cls = new MyClass();
        Class c = cls.getClass();

        // constructors
        Constructor[] ct = c.getDeclaredConstructors();
        for (int i = 0; i < ct.length; i++) {
            System.out.println("Constructor found: " + ct[i].toString());
        }
    }
}

class MyClass {
    public MyClass() {
        System.out.println("no argument constructor");
    }

    public MyClass(Double d, Long l) {
        this.d = d;
        this.l = l;
    }

    Double d = new Double(3.9d);
    Long l = new Long(123);
}