Java2all.com  

Assignment Operator





Share This Topic -

var = expression;

int x, y, z;

x = y = z = 50; // set x, y, and z to 50

EX.

 public class Assignment_OperatorDemo
{
	public static void main(String[] args) 
	{
		System.out.println("<------------Assignment Operator------------->");
		int x,y,z,sum;
		x = y = z = 50;		//The Assignment Operator which assign the value to a varible
		sum = x + y + z;
		System.out.println("x + y + z = "+sum);
	}
}

Output :
 
<------------Assignment Operator------------->
x + y + z = 150