| Java | C++ |
|---|---|
| Method bodies must be defined inside the class to which they belong. |
Method bodies must be defined inside the class to which they belong. |
| No forward referencing required. | Explicit forward referencing required. |
| No preprocessor. | Heavy reliance on preprocessor. |
| No comma operator. | Comma operator. |
| No variable-length parameter lists. | Variable-length parameter lists. |
| No optional method parameters. | Optional function parameters. |
No const reference parameters. |
const reference parameters. |
No goto
| goto
|
| Labels on break and continue. | No labels on break and continue. |
| Command-line arguments do not include the program name. |
Command-line arguments do not include the program name. |
| Main method cannot return a value. | Main function can return a value. |
| No global variables. | Global variables. |
| Character escape sequences can appear in a program. | Character escape sequences must appear in a string or character literal. |
| Cannot mask identifiers through scope. | Can mask identifiers through scope. |