Operator in Java Program-4

Operator in Java Program – 4

Operator is very import for all languages. Operator can calculate, check, assign, increase and decrease the value of variable. So operator is heart of java program. I give simple example of operator in program.

“X = Y”;

In this example ans, Y and X are variable;

= (assignment) operators. “

So we can easily understand the import of operator in java program language. In this blog we will discuss on Assignment [ = ] operators and its sub operator like Arithmetic assignment, bitwise assignment operator.

  1. Assignment operator

= is symbol of Assignment operator.

Using of this operator we can store value from one variable to another variable.

Let’s take simple example.

int x = 10;

int y = x;        // Here x assigns its value to y variable.

  1. Sub part of assignment operator

Arithmetic assignment, bitwise assignment operator are part of this sub part.

Let’s take simple example.

int x = 10;

x = x+2;         // this is simple statement

x+=2;             // this is arithmetic assignment statement

Here both statements are valid in program.


Program on Assignment Operator:

class op4


          public static void main(String args[])


                   int x = 50;

                   int y = x;     // x assigns its value to y , y = 50

                   System.out.println(“Y = ” + y);

                   // x = x * 2;

                   x*=3;           // This is call Arithmetic Assignment operator

                   System.out.println(“X = ” + x);        // X = 100




Y = 50

X = 100


Video available on YouTube.



If you have problem on this blog, you can directly comment or subscribe on website.

Earn money online

955total visits,1visits today


Hello, I am Maddy a Java blogger, trainer and developer

Related articles

Comments are closed.