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. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static class Point {
  11.  
  12. int x, y;
  13.  
  14. Point(int x, int y) {
  15. this.x = x;
  16. this.y = y;
  17. }
  18.  
  19. void move(int dx, int dy) {
  20. x += dx;
  21. y += dy;
  22. }
  23.  
  24. public String toString() {
  25. return "(" + x + ", " + y + ")";
  26. }
  27.  
  28. }
  29. static void m(Point pp, int dd, int[] aa) {
  30. pp.move(dd, dd);
  31. dd = 117;
  32. aa[3] = 22;
  33. }
  34. public static void main (String[] args) throws java.lang.Exception
  35. {
  36. Point p = new Point(10, 20);
  37. int[] a = new int[5];
  38. int d = 8;
  39. System.out.println("p is " + p);
  40. System.out.println("a[3] is " + a[3]);
  41. m(p, d, a);
  42.  
  43. System.out.println("p is " + p);
  44. System.out.println("d is " + d);
  45. System.out.println("a[3] is " + a[3]);
  46. }
  47. }
Success #stdin #stdout 0.04s 2184192KB
stdin
Standard input is empty
stdout
p is (10, 20)
a[3] is 0
p is (18, 28)
d is 8
a[3] is 22