fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6. import java.lang.reflect.Field;
  7.  
  8.  
  9. /* Name of the class has to be "Main" only if the class is public. */
  10. class Ideone
  11. {
  12. public static void main (String[] args) throws java.lang.Exception
  13. {
  14. new Ideone().exampleInt();
  15. }
  16.  
  17. void exampleInt() {
  18. Integer i = new Integer(32);
  19. System.out.println("I: " + i);
  20. intInsisde(i);
  21. System.out.println("I2: " + i);
  22. }
  23.  
  24. void intInsisde(Integer i) {
  25. try {
  26. Field field = Integer.class.getDeclaredField("value");
  27. field.setAccessible(true);
  28. field.setInt(i, 707);
  29.  
  30. } catch (Exception e) {
  31. //
  32. }
  33. System.out.println("I w srodku: " + i);
  34. }
  35. }
Success #stdin #stdout 0.04s 2184192KB
stdin
Standard input is empty
stdout
I: 32
I w srodku: 707
I2: 707