Thursday, 6 February 2014

ICSE 10th Standard Notes – Assignment and Shorthand Operator in Java

Assignment Operator :

The assignment operator in Java is used to Assign a value to a variable or assign an expression to the variable. The Assignment operator is : “ = ”

Example : 

a=10;
sum=a+b;

Shorthand Assignment Operators :

Java provides a set of Shorthand Assignment Operators that simplify the coding of a certain type of assignment statements.

Example : a += 10;

Note : a += 10 refers to a=a+10;

The operator pair += tells the compiler to assign to ‘a’ the value of a+10.

Syntax : variable operators= expression;

Shorthand Assignment Operators :


Operator : +=
Usage : a+=b
Equivalent To : a=a+b
Operator : -=
Usage : a-=b
Equivalent To : a=a-bOperator : *= Usage : a*=b Equivalent To :a=a*b
Operator : /= Usage : a/=b Equivalent To :a=a/b
Operator : %= Usage : a%=b Equivalent To : a=a%bOperator : &= Usage : a&=b Equivalent To : a=a&bOperator : != Usage : a!=b Equivalent To : a=a!bOperator : ^= Usage : a^=b Equivalent To : a=a^bOperator : <<= Usage : a<<=b Equivalent To : a=a<<bOperator : >>= Usage : a>>=b Equivalent To : a=a>>bOperator : >>>=
Usage : a>>>=b
Equivalent To : a=a>>>b


ICSE 10th Standard Notes – Variables in Java
ICSE 10th Standard Notes – Increment and Decrement Operators in Java
ICSE 10th Standard Notes – Shift and Bitwise Operator in Java
ICSE 10th Standard Notes – Constants and Operators in Java
ICSE 10th Standard Notes – Arithmetic Operators and their precedence in Java
ICSE 10th Standard Notes – Statements in Java
ICSE 10th Standard Notes – Some Operators in Java
ICSE 10th Standard Notes – Relational Operators in Java
ICSE 10th Standard Notes – Expressions in Java
ICSE 10th Standard Notes – Boolean Expressions in Java
ICSE 10th Standard Notes – Escape Sequences in Java

Get Ebooks delivered to your email id

Comments

Subscribe to our channel

Facebook

Powered by Blogger.

Home | Contact Us | DMCA | Terms of Service | Privacy | Advertise

Maven Scientists