Jenis Variable :
Literal :
Ekspresi Dan Operator :
G. Lain - lain.
Tipe | Ukuran | Nilai |
byte | 8 bits | -128 to 127 |
short | 16 bits | -32,768 to 32,767 |
int | 32 bits | -2,147,483,648 to 2,147,483,647 |
long | 64 bits | -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 |
float | 32 bits | single precision |
double | 64 bits | double precision |
char | 16 bits | unsigned |
boolean | 1 bit | true atau false |
Literal :
Escape | Arti |
\n | Newline |
\t | Tab |
\b | Backspace |
\r | Carriage return |
\f | Formfeed |
\\ | Backslash |
\' | Single quote |
\" | Double quote |
\ddd | Octal |
\xdd | Hexadecimal |
\udddd | Unicode character |
Ekspresi Dan Operator :
A. Operator aritmatika | |
Operator | Arti |
+ | Addition |
- | Subtraction |
* | Multiplication |
/ | Division |
% | Modulus |
B. Operator assignment | |
Ekspresi | Arti |
x += y | x = x + y |
x -= y | x = x – y |
x *= y | x = x * y |
x /= y | x = x / y |
C. Operator perbandingan | |
Operator | Arti |
== | Equal |
!= | Not equal |
< | Less than |
> | Greater than |
<= | Less than or equal to |
>= | Greater than or equal to |
D. Operator bitwise | |
Operator | Arti |
& | Bitwise AND |
| | Bitwise OR |
^ | Bitwise XOR |
<< | Left shift |
>> | Right shift |
>>> | Zero fill right shift |
~ | Bitwise complement |
<<= | Left shift assignment (x = x << y) |
>>= | Right shift assignment (x = x >> y) |
>>>= | Zero fill right shift assignment (x = x >>> y) |
x&=y | AND assignment (x = x & y) |
x|=y | OR assignment (x = x | y) |
x^=y | XOR assignment (x = x ^ y) |
E. Operator increment decrement | |
Operator | Arti |
++ | increment |
-- | decrement |
F. Operator logika | |
Operator | Arti |
&& | AND |
|| | OR |
G. Lain - lain.
Operator | Keterangan |
. [] () | Tanda kurung, (), digunakan untuk mengumpulkan ekspresi dalam satu group; tanda titik, ., digunakan untuk mengakses metode dan variabel dalam sebuah objek atau kelas; tanda kurung siku, [], digunakan dalam array. |
++ -- ! ~ instanceof | Operator instanceof menghasilkan true atau false berdasarkan apakah objek tertentu adalah sebuah instans dari kelas tertentu atau subkelas dari kelas tertentu. |
new (type)expression | Operator new digunakan untuk membuat instans baru dari kelas; () di sini berguna untuk casting sebuah nilai menjadi tipe tertentu. |
* / % | Perkalian, pembagian, modulus |
+ - | Penambahan, pengurangan |
<< >> >>> | Bitwise geser kiri dan kanan |
< > <= >= | Tes perbandingan relasional |
== != | Persamaan |
& | AND |
^ | XOR |
| | OR |
&& | Logical AND |
|| | Logical OR |
? : | if...then...else |
= += -= *= /= %= ^= | Assignment |
&= |= <<= >>= >>>= | Assignment |
0 komentar:
Posting Komentar
: Ayoo sharingg.. :D