Assignment operator is used to assign a value to any variable. It has a right to left associativity, i.e value given on right hand side of operator is assigned to the variable on the left and therefore right hand side value must be declared before using it or should be a constant.  In many cases assignment operator can be combined with other operators to build a shorter version of statement called Compound Statement. For example, instead of a = a+5, we can write a += 5. 

  •  For adding left operand with right operand and then assigning it to variable on the left.(+=)
  •  For subtracting left operand with right operand and then assigning it to variable on the left.(-=)
  •  For multiplying left operand with right operand and then assigning it to variable on the left.(*=)
  •  For dividing left operand with right operand and then assigning it to variable on the left.(/=)
  •  For assigning modulo of left operand with right operand and then assigning it to variable on the left.(%=)

Program:

public class AssignmentOperator { public static void main(String args[]) { int a = 10; int b = 20; int c = 0; c += a ; System.out.println("c += a = " + c ); c -= a ; System.out.println("c -= a = " + c ); c *= a ; System.out.println("c *= a = " + c ); a = 10; c = 15; c /= a ; System.out.println("c /= a = " + c ); a = 10; c = 15; c %= a ; System.out.println("c %= a = " + c ); } }

Output:

c += a = 10 c -= a = 0 c *= a = 0 c /= a = 1 c %= a = 5

  • Progamming is what actually means ?
  • What is software development ?
  • How we categorized software development in different manner.
C Programming
C Plus Plus
Python
Java Development
Web Designing
Javascript
Mysql
Oracle
We cover all the programming concepts in various programming languages, this tutorials are very help full for bigener as well as Experience developer, for the ease of understanding we categorized programming in different manner likewise.