|
Java Stuff
|
|
Comparison Operators
|
Operators
|
Description |
|
==
|
Equal to |
|
<
|
Less than |
|
>
|
Greater than |
|
<=
|
Less than or equal to |
|
>=
|
Greater than or equal to |
|
!=
|
Not equal to |
|
|
Logical Operators
|
Operator
|
Description |
|
&&
|
AND |
|
||
|
OR |
|
^
|
Exclusive OR |
|
!
|
NOT |
|
Order of Operations
| Operators |
Description |
| ! |
NOT |
| < > <= >= |
Relational |
| == != |
Equality |
| ^ |
Exclusive OR |
| && |
Logical AND |
| || |
Logical OR |
|
The if and else
| |
if (choice == 1)
{
num = 1;
num2 = 10;
}
else
{
num = 2;
num2 = 20;
} |
|
| |
|
| |
if (choice == 1)
{
num = 1;
num2 = 10;
}
else if (choice == 2)
{
num = 2;
num2 = 20;
}
else if (choice == 3)
{
num = 3;
num2 = 30;
} |
|
|
|
The SWICH command
| |
if (x == 1)
y = 1;
if (x == 2)
y = 2;
if (x == 3)
y = 3;
else
y = 0;
|
|
| |
The same code written by using
the Swich command. |
| |
switch(x)
{
case 1:
y = 1;
break;
case 2:
y = 2;
break;
case 3:
y = 3;
break;
default:
y = 0;
}
|
|
|
|
To download Java
Click Here
|
| Was this article helpful? Do you still have any questions?
What can I do to improve this article?
Click
Here and tell me. |
| © MyOnlyPage.NET |