jeliot.io import .*; public class Numbers { public Num (int x) {/ / constructor a = x; } public static void swap (Num a, Num b) { int temp; temp = a.a; a.a = b.a; b.a = temp; } public final void output () { System.out.println ("number:" + a); } private int a; public static void main () { System.out.println ("\ nUsing class \ n"); Numbers x1 = new Numbers (5); Numbers y1 = new Numbers (6); x1.output (); y1.output (); swap (x1, y1); System.out.println ("\ nAfter swap disposable class: \ n"); x1.output (); y1.output (); } }
0 Response for the "Swap Reference Java Jeliot"
Post a Comment