Click here to watch in Youtube :
https://www.youtube.com/watch?v=u9S40sDGyWs&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge
Java Tutorial : Java Assignment Operators |
class AssignmentOperatorDemo1 { public static void main(String[] args) { int a = 5; int b = 2; /* * Assigns value from right side operands to left side operand. */ a = b; System.out.println("a = " + a); } }
a = 2
class AssignmentOperatorDemo2 { public static void main(String[] args) { int a = 5; int b = 2; /* * Adds right operand to the left operand and assign the result to left. * * a+=b is same as a=a+b */ a += b; System.out.println("a = " + a); } }
a = 7
class AssignmentOperatorDemo3 { public static void main(String[] args) { int a = 5; int b = 2; /* * subtracts right operand from the left operand and assign the result * to left operand. * * a-=b is same as a=a-b */ a -= b; System.out.println("a = " + a); } }
a = 3
class AssignmentOperatorDemo4 { public static void main(String[] args) { int a = 5; int b = 2; /* * mutiply left operand with the right operand and assign the result to * left operand. * * a*=b is same as a=a*b */ a *= b; System.out.println("a = " + a); } }
a = 10
class AssignmentOperatorDemo5 { public static void main(String[] args) { int a = 5; int b = 2; /* * Adds right operand to the left operand and assign the result to left. * * same as a=a/b */ a /= b; System.out.println("a = " + a); } }
a = 2
class AssignmentOperatorDemo6 { public static void main(String[] args) { int a = 5; int b = 2; /* * calculate modulus using two operands and assign the result to left * operand. * * a%=b is same as a=a%b */ a %= b; System.out.println("a = " + a); } }
a = 1
https://sites.google.com/site/javaee4321/java/OperatorsDemoAssignmentApp.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/OperatorsDemoAssignmentApp
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/e1afee1d6e12479b500465256b2025d133889626/BasicJava/OperatorsDemoAssignmentApp/?at=master
See also:
No comments:
Post a Comment