fork(7) download
  1. /* Name of the class has to be "Main" only if the class is public. */
  2. class Ideone
  3. {
  4. static class A {
  5. public A(Class clz) { System.out.println("Here!"); }
  6. }
  7.  
  8. public static void main (String[] args) {
  9. try {
  10. A.class.getDeclaredConstructor(Class.class).newInstance(Ideone.class);
  11. } catch (Exception e) {
  12. System.out.println("Oh dear");
  13. }
  14. }
  15. }
Success #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout
Here!