Arithmetic Operators.

PHOTO EMBED

Sat Apr 17 2021 17:48:38 GMT+0000 (UTC)

Saved by @ahmedqgqgq #java

public class MyProgram {
	public static void main(String[] args) {
		//Arithmetic Operators.
		//Relational Operators.
		//Bitwise,Logical,Assignment,Operators.
		//Miscellaneous Operators.
	}
}
public class MyProgram {
	public static void main(String[] args) {
		int x=10;
		System.out.println("x=="+x);
   }
}
public class MyProgram {
	public static void main(String[] args) {
		System.out.println(5+6*2);//17
        System.out.println(( 5 + 6 )*2);//22
	}
}
public class MyProgram {
	public static void main(String[] args) {
		int x=(5+6)*2;  
		System.out.println(x);
	}
}
//search operators precedence in java;
public class MyProgram {
	public static void main(String[] args) {
		int x = 5 * (2 * (2 + 1));
		//2+1=3
		//2*3=6
		//5*6
		System.out.println(x);
	}
}
public class MyProgram {
	public static void main(String[] args) {
		int x = 5 * 2 / 2;//left to right
		System.out.println(x);
	}
}
public class MyProgram {
	public static void main(String[] args) { 
		System.out.println(2%5);
		System.out.println(5%5);
		System.out.println(6%5);
		System.out.println(7%5);
		System.out.println(8%5);
		System.out.println(9%5);
		System.out.println(10%5);
    }
}
public class MyProgram {
	public static void main(String[] args) {
		int x = 2 % (5 + 5) * 3;
		System.out.println(x);
	}
}
public class MyProgram {
	public static void main(String[] args) {
		/*byte short =short
		int int = int 
		int float = float
		float double = double 
		int float short double =double*/
	}
}
public class MyProgram {
	public static void main(String[] args) {
		System.out.println(15/2);
	}
}
public class MyProgram {
	public static void main(String[] args) {
		System.out.println(15.0/2);
	}
}
public class MyProgram {
	public static void main(String[] args) {
		System.out.println(15.0f/2);
	}
}
public class MyProgram {
	public static void main(String[] args) {
		int x=9,y=2;
		System.out.println(x/y);  
	}
}
public class MyProgram {
	public static void main(String[] args) {
		int x = 9, y = 2;
		System.out.println((float) x / y);//Type casting
	}
}
public class MyProgram {
	public static void main(String[] args) {
		int x = 9, y = 2;
		System.out.println((float) x / y);//Type casting
		//Widening primitive conversions
		//Narrowing primitive conversions
	}
}
public class MyProgram {
	public static void main(String[] args) {
		int x = 9, y = 2;
		System.out.println( x / y);//Type casting
		// Widening primitive conversions
		// Narrowing primitive conversions
	}
}
public class MyProgram {
	public static void main(String[] args) {
		int x = 9, y = 2;
		System.out.println((int) x /  y);//Type casting
		// Widening primitive conversions
		// Narrowing primitive conversions
	}
}

	




content_copyCOPY