public class lab14 { public static void main(String[] args) { int a=10; int b=20; System.out.println("values before the call a="+a+"b="+b); swap(a,b); System.out.println("value after the call a="+a+"b="+b); } public static void swap(int a,int b) { System.out.println("inside swap(),before swapping...."); System.out.println("a="+a+"b="+b); int temp =a; a=b; b=temp; System.out.println("inside swap after swapping a="+a+"b="+b); } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter