public class MyProgram { public static void main(String[] args) { int x = 1; x++;//postfix/post(increment) System.out.println(x); ++x;//prefix/pre(increment) System.out.println(x); } } public class MyProgram { public static void main(String[] args) { int x = 1; System.out.println("x==" + ++x);//prefix int y = 1; System.out.println("y==" + y++);//postfix } } public class MyProgram { public static void main(String[] args) { int x = 1; System.out.println("x=" + x++ +"*"+ ++x +"*"+ x++); System.out.println("x=" + x); } } public class MyProgram { public static void main(String[] args) { int x = 1, y,z; y = x++; z=++x; System.out.println("y="+y); System.out.println("x="+x); System.out.println("z="+z); } } public class MyProgram { public static void main(String[] args) { int x=1,y; y=++x + x++; System.out.println("y=="+y); System.out.println("x=="+x); } } public class MyProgram { public static void main(String[] args) { int x = 1, y; y = (++x*2 + x++%2)/2; System.out.println("y==" + y); System.out.println("x==" + x); } } //the Assignment operators public class MyProgram { public static void main(String[] args) { int k=5; k=k+10;//k+=10 System.out.println("K=="+k); } }
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