Popular Google Pages:
◕ Bengali Story writing competition. More..
This article is regarding Assignment Statement & Assignment Operator in Java.
Last updated on: 27th February 2017.
◕ What is assignment statement in Java?
Let have an example first:
numBalls = redBalls + blueBalls;
This is an Assignment Statement.
Here we add redBalls with blueBalls and put the result value on the variable numBalls.
Obviously we have to declare the initial value of these three variables before this Assignment Statement.
( Here the variables are numBalls, redBalls, blueBalls. )
Note that the statement is terminated by the semicolon. This means the end of the statement.
It is important to know that here the Equal Sign ( = ) is called the Assignment Operator.
◕ An Assignment Statement will always consist three things:
- The name of the variable where you want the result to store.
Here it is numBalls.
- The Assignment Oprator.
Here it is Equal Sign ( = ).
- An arithmetic expression for calculation to produce the result.
Here it is redBalls + blueBalls.
Related Java articles:
■ What is Java? Where we can apply Java?
■ Why Java is a Machine Independent Program? What is Machine Independent Program?
■ Root Directory of Java
■ How to Compile and run a Java Program?
■ What is .class file in Java?
■ What is variable in a program?
■ What is identifier in Java?
■ Integer data types in Java?
■ What is Primitive Types in Java?
■ How to declare constant variables in Java?
■ Why should we declare the initial value of a variable in Java?
■ Use of Underscores to write an integer in Java
Top of the page