fork download
  1. public class HelloWorld
  2. {
  3. public static void main(String[] args) throws Exception {
  4. System.out.println("Hello World!");
  5.  
  6. Object obj = new Object() {
  7. public void hoge() {
  8. System.out.println("hoge "+this.toString());
  9. }
  10. };
  11.  
  12. System.out.println(obj);
  13. Class c = obj.getClass();
  14. System.out.println(c);
  15. java.lang.reflect.Method m = c.getMethod("hoge");
  16. m.invoke(obj);
  17.  
  18. Object obj2 = c.newInstance();
  19. System.out.println(obj2);
  20. Class c2 = obj2.getClass();
  21. System.out.println(c2);
  22. java.lang.reflect.Method m2 = c2.getMethod("hoge");
  23. m2.invoke(obj2);
  24.  
  25. }
  26. }
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty