public static void main(String[] args) {
int a = 100;
int b = 20;
System.out.println("a = " +a+ ", b = " + b);
int temp = a;
a = b;
b = temp;
System.out.println("a = " +a+ ", b = " + b);
}
}
//output:
a = 100, b = 20
a = 20, b = 100
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