Course Content

Course Content


Assignment Operator in Java

From the previous video of our ongoing course on Core Java we have seen that what are Logical operators in Java and how many Logical operators do Java supports. Now in this video we are going to see what are Assignment operators in Java.

Assignment operators in Java programming language are used to assign values to the variables. The following are the Assignment operators in Java used :

  • '=' : assign value from right side operand to left side operand
  • '+=' : adds right operand to the last operand and assign the result to left
  • '-=' : subtracts right operand from the left operand and assign the result to left operand
  • '*=' : multiply left operand with the right operand and assign the result to operand
  • '\=' : divides left operand with the right operand and assign result to left operand
  • '%=' : calculate modulus using two operand and assign the result of the operand

To gain an accurate understanding about Assignment operators in Java, now we will do Programming,
class demo
public static void main (String[] args)
int x=10,y=20;
int ans=+x;
System.out.println("+x=" + ans);
System.out.println("-y=" + ans);
System.out.println("++x=" + ans);
System.out.println("--y=" + ans);
System.out.println("x++=" + ans);
System.out.println("y--=" + ans);
Output :
+x= 10
-y= -20
++x= 11
--y= 19
x++= 11
y--= 19

So, this is how Assignments Operators in Java works and by completing Assignment operators, we have covered all the Operators of Java in our Core Java course. In the next video we will see what are Flow Control Statements in Java and what are Conditional Statements in Java.


Recommended Courses

Share With Friend

Have a friend to whom you would want to share this course?

Download The Apps

Code Scan or Download the app
Google Play Store
297K+ Downloads
4.5 Rating
10K+ Reviews
  • Learn anywhere on the go
  • Get regular updates about your enrolled or new courses
  • Share content with your friends
  • Evaluate your progress through practice tests
  • No internet connection needed
  • Enroll for the webinar and join at the time of the webinar from anywhere