fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. // your code goes here
  13. Test test = new Test("world");
  14. System.out.println(test.field);
  15. }
  16.  
  17.  
  18. }
  19.  
  20. class Test {
  21. public int field = 666;
  22.  
  23. Test() {
  24. System.out.println("hello");
  25. }
  26.  
  27. protected Test(String test) {
  28. System.out.println("hello " + test);
  29. }
  30. }
  31.  
Success #stdin #stdout 0.1s 320512KB
stdin
Standard input is empty
stdout
hello world
666