Java Operators

Java Operators - ජාවා කර්ම

සාමානය ගණිතය තමයි මෙතැනදී සාකච්චා වෙන්නේ.
සමහර අවස්ථා වල වෙනස් කම් තිබුනට සම්පුර්ණ ගනිතයමයි කිව්වොත් නිවැරදියි.


උදාහරණයක් ලෙස Variable 3 ක් Define කරගෙන ඒවාට Values Initialize කරගන්නවා. 



int a=14;  
int b=8;
int c;

Arithmetic Operators

Operators
Operators name
usage
result
+
Addition
C = a + b
C = 22
-
Subtraction 
C= a - b
C = 6
*
Multiplication      
C = a * b
C = 112
/
Division
C = a / b
C = 1
%
Modulus
C = a % b
C = 6
++
Increment
C = a++
C = 15
--
Decrement
C = b--
C = 7

Assignment Operators
Operators
Operators name
usage
result
+=
Addition  Assignment     
a+= b
a = 22
-=
Subtraction  Assignment  
a-= b
a = 6
*=
Multiplication  Assignment
a*= b
a = 112
/=
Division  Assignment
a/= b
a = 1
%=
Modulus  Assignment     
a%= b
a = 6


                                                
Ex: Increment & Decrement
int x=10;
x++;
SOP(x);
int x=10;
++x;
SOP(x);
int x=10;
SOP(x++);
SOP(x);
int x=10;
SOP(++x);
SOP(x);
Answers



11
11
11
11
10
11
 
SOP යනු කෙටියෙන් System.out.println(); කියන එකයි.

Unknown

Author & Editor

Has laoreet percipitur ad. Vide interesset in mei, no his legimus verterem. Et nostrum imperdiet appellantur usu, mnesarchum referrentur id vim.

0 comments:

Post a Comment