|
|
|
|
| break | break | Break out of while and for loops. |
| case | case | The case statement. |
| class Test | class Test | Start of the class definition for Test. |
| const int a = 1; | final int a = 1; | Constant a is assigned the value of 1. |
| continue | continue | Skip the rest of the statements and continue the while or for loop. |
| else | else | The else statement. |
| for | for | The for loop. |
| if | if | The if statement. |
| #include <stdio.h> | import java.io.*; | Including class libraries. |
| a = new aClass; | a = new aClass(); | The creation of an instance of the class aClass. |
| private:
void aMethod( void ); int a; |
private void aMethod();
private int a; |
Private method aMethod and private field a. |
| protected:
void aMethod( void ); int a; |
protected void aMethod();
protected int a; |
Protected method aMethod and protected field a. |
| public:
void aMethod( void ); int a; |
public void aMethod();
public int a; |
Public method aMethod and public field a. |
| switch | switch | The switch statement. |
| virtual aMethod( void ) = 0; | abstract void aMethod(); | Abstract method aMethod. |
| class A : public B | class A extends B | Class A inherits the attributes of class B. Single inheritance for Java and multiple inheritance for C++. |
| try
{ <statements> } catch( anException e) { <statements> } |
try
{ <statements> } catch( anException e) { <statements> } finally { <statements> } |
Creating exception handlers. |
| class A : public B, public C | class A implements B, C | Class A implements the interfaces B and C. In the C++ case, the classes B and C are abstract classes. |
| namespace A { } | interface A { } | Creating an interface (grouping related functions). |
| while | while | The while loop. |
|
|
|
|
|
|
|
Parentheses that do the following:
|
|
|
|
Indicate the array subscripts. |
|
|
|
Message passing and direct access to class fields. |
|
|
|
Logical negation. |
|
|
|
Increment. |
|
|
|
Decrement. |
|
|
|
Multiplication. |
|
|
|
Division. |
|
|
|
Modulus. |
|
|
|
Addition. |
|
|
|
Subtraction. |
|
|
|
Greater than. |
|
|
|
Greater than or equal to. |
|
|
|
Less than. |
|
|
|
Less than or equal to. |
|
|
|
Equal to. |
|
|
|
Not equal to. |
|
|
|
Logical AND (conjunction). |
|
|
|
Logical OR (disjunction). |
|
|
|
Assignment. |
|
|
|
Addition followed by assignment. |
|
|
|
Subtraction followed by assignment. |
|
|
|
Multiplication followed by assignment. |
|
|
|
Division followed by assignment. |
|
|
|
Modulus followed by assignment. |
highest ()
[] .
++
-- ~ !
*
/ %
+
-
>>
>>> <<
>
>= < <=
==
!=
&
^
|
&&
||
lowest =
+= -= *=
/= %=
Note that since the sizes vary in C++, the comparison below is strictly
from a functional view only.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|