fork download
  1. {
  2.  
  3. int x = 20;
  4.  
  5. void display(int x)
  6. {
  7. System.out.print(x);
  8. System.out.print(this.x);
  9. }
  10.  
  11.  
  12. public static void main(String[] args)
  13. {
  14. Test t = new Test();
  15. t.display(30);
  16.  
  17. }
  18.  
  19. }
  20.  
  21.  
  22. /* package whatever; // don't place package name! */
  23.  
  24. import java.util.*;
  25. import java.lang.*;
  26. import java.io.*;
  27.  
  28. /* Name of the class has to be "Main" only if the class is public. */
  29. class Ideone
  30. {
  31. public static void main (String[] args) throws java.lang.Exception
  32. {
  33. // your code goes here
  34. }
  35. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: class, interface, or enum expected
{
^
Main.java:3: error: class, interface, or enum expected
    int x = 20;
    ^
Main.java:3: error: class, interface, or enum expected
    int x = 20;
        ^
Main.java:5: error: class, interface, or enum expected
    void display(int x)
    ^
Main.java:8: error: class, interface, or enum expected
        System.out.print(this.x);
        ^
Main.java:9: error: class, interface, or enum expected
    }
    ^
Main.java:12: error: class, interface, or enum expected
    public static void main(String[] args)
                  ^
Main.java:15: error: class, interface, or enum expected
        t.display(30);
        ^
Main.java:17: error: class, interface, or enum expected
    }
    ^
9 errors
stdout
Standard output is empty