Java program to perform the assignment operations
KW.java
class KW
{
    public static void main(String args[])
    {
        int a=10,b=50,c;
        System.out.println("———————————————————————————————————————————");
        System.out.println("Program to perform the assignment operations");
        System.out.println("———————————————————————————————————————————");
        System.out.println("Value Of a    | "+a);       //a=10
        System.out.println("Value Of b    | "+b);       //b=50
        System.out.println("Value Of a+=b | "+(a+=b));  //a=a+b=60
        System.out.println("Value Of a-=b | "+(a-=b));  //a=60-10=50
        System.out.println("Value Of a*=b | "+(a*=b));  //a=50*10=500
        System.out.println("Value Of a/=b | "+(a/=b));  //a=500/10=50
        System.out.println("Remainder a%=b| "+(a%=b));  //a=50%10=10
        System.out.println("Value Of a^=b | "+(a^=b));  //a=10
        System.out.println("Value Of a|=b | "+(a|=b));
        System.out.println("Value Of a&=b | "+(a&=b));
        System.out.println("———————————————————————————————————————————");
    }
}
Output
kodingwindow@kw:~$ javac KW.java
kodingwindow@kw:~$ java KW ——————————————————————————————————————————— Program to perform the assignment operations ——————————————————————————————————————————— Value Of a | 10 Value Of b | 50 Value Of a+=b | 60 Value Of a-=b | 10 Value Of a*=b | 500 Value Of a/=b | 10 Remainder a%=b| 10 Value Of a^=b | 56 Value Of a|=b | 58 Value Of a&=b | 50 ——————————————————————————————————————————— kodingwindow@kw:~$
Advertisement