fork download
  1. class Wrapper{
  2. int w =10;
  3. }
  4.  
  5. class TestClass{
  6. static Wrapper changeWrapper(Wrapper w){
  7. w=new Wrapper();
  8. w.w +=9;
  9. return w;
  10. }
  11. public static void main (String [] args){
  12. Wrapper w=new Wrapper();
  13. w.w=20;
  14. changeWrapper(w);
  15. w.w+=30;
  16. System.out.println(w.w);
  17. w=changeWrapper(w);
  18. System.out.println(w.w);
  19.  
  20. }
  21. }
Success #stdin #stdout 0.08s 54632KB
stdin
Standard input is empty
stdout
50
19