Arithmetic Operators (Prefix & Postfix).

PHOTO EMBED

Sat Apr 17 2021 21:58:12 GMT+0000 (Coordinated Universal Time)

Saved by @ahmedqgqgq #java

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);
	}
}
content_copyCOPY