java -= operators code example
Example 1: Operators in java
public class AssignmentOperatorDemo
{
public static void main(String[] args)
{
int numOne = 60;
int numTwo = 30;
numTwo += numOne;
System.out.println("(+=) : " + numTwo);
numTwo -= numOne;
System.out.println("(-=) : " + numTwo);
numTwo *= numOne;
System.out.println("(*=) : " + numTwo);
numTwo /= numOne;
System.out.println("(/=) : " + numTwo);
numTwo %= numOne;
System.out.println("(%=) : " + numTwo);
}
}
Example 2: Operators in java
public class ArithmeticOperatorDemo
{
public static void main(String[] args)
{
int i = 25;
int j = 5;
System.out.println(i + j);
System.out.println(i - j);
System.out.println(i * j);
System.out.println(i / j);
System.out.println(i % j);
}
}