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. class Value {
  8. public int i = 15;
  9. }
  10. public class Test {
  11. public static void main(String argv[]) {
  12. Test t = new Test();
  13. t.first();
  14. }
  15. public void first() {
  16. int i = 5;
  17. Value v = new Value();
  18. v.i = 25;
  19. second(v, i);
  20. System.out.println(v.i);
  21. }
  22. public void second(Value v, int i) {
  23. i = 0;
  24. v.i = 20;
  25. Value val = new Value();
  26. v = val; System.out.println(v.i + " " + i);
  27. }
  28. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:10: error: class Test is public, should be declared in a file named Test.java
public class Test {
       ^
1 error
stdout
Standard output is empty