Primitive Data Types
Type |
Size |
Range/Value |
byte |
8 bits |
-128 .. 127 |
short |
16 bits |
-32,768 .. 32,767 |
int |
32 bits |
-2,147,483,648 .. 2,147,483,647 |
long |
64 bits |
-9,223,372,036,854,775,808 .. 9,223,372,036,854,775,807 |
float |
32 bits |
3.40282347 x 1038, 1.40239846 x 10-45 |
double |
64 bits |
1.7976931348623157 x 10308, 4.9406564584124654 x 10-324 |
boolean |
|
True/False |
char |
|
Single Characters |
String |
|
A String of Characters |
Escaped Characters
|
Action |
\b |
Backspace |
\n |
New Line |
\t |
Tab |
\r |
Carriage Return |
\f |
Form Feed |
\" |
Double Quote |
\\ |
Back Slash |
Key Words
Key Word |
Description |
class |
Blueprint for an Object |
main |
public |
Available to all Classes |
private |
Available to this Class only |
protected |
Available to this Package only |
static |
void |
Does not return any values |
final |
Always remains the same (constant) |
new |
Creates a new object |
this |
|
|
Arithmetic Operators
Operator |
Action |
+= |
Add |
-= |
Subtract |
*= |
Multiply |
/= |
Divide |
%= |
Remainder |
++ |
Increment by 1 |
-- |
Decrement by 1 |
Equality and Relational Operators
Operator |
Action |
> |
Greater Than |
< |
Less Than |
== |
Equal To |
!= |
NOT Equal To |
>= |
Greater Than or Equal To |
<= |
Less Than or Equal To |
Conditional Operators
Operator |
Action |
&& |
Returns true if boolean value on the right and left are both true |
|| |
Returns true if either boolean value on the right or left are true |
! |
Converts the boolean value to its right to its opposite |
^ |
Returns true if there is 1 true and 1 false boolean value on the right or left |
|