fork download
  1. class Foo {
  2. static class Bar {
  3. public String name = "msg 1";
  4. }
  5.  
  6. static void change (Bar bar) {
  7. bar.name = "msg 2";
  8. }
  9.  
  10. public static void main (String[] args) {
  11. Bar bar = new Bar();
  12. System.out.println(bar.name);
  13. change(bar);
  14. System.out.println(bar.name);
  15. }
  16. }
Success #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout
msg 1
msg 2