WAP to use Assignment Operator in Java

 class Assignment

{

public static void main(String []arg)

{

int a=10;

int n;

System.out.println("Initial value of 'a' is: "+a);

//=Assignment Operator

n=a;

System.out.println("a value is assignment to n using =operator: "+n);

n+=a;

System.out.println("n using+=operator:"+n);

n-=a;

System.out.println("n using-=operator:"+n);

n*=a;

System.out.println("n using*=operator:"+n);

n/=a;

System.out.println("n using/=operator:"+n);

n%=a;

System.out.println("n using%=operator:"+n);

}

}

Comments

Popular posts from this blog

Completed Certification from J.P. Morgan - Software Engineering Job Simulation

Wap to use Ternary Operator in Java

Wap to Use Increment And Decrement Operator In Java