| Java is case-sensitive
* main(), Main(), and MAIN() would all be different methods
There are a limited number of reserved words that have a special meaning within Java.
* you may not use these words for your own variables or methods
* examples: public, void, static, do, for, while, if
Most keyboard symbol characters (the set of characters other than alphabetic or numeric) have a special meaning
Names may contain alphabetic characters, numeric characters, currency characters, and connecting characters such as the underscore ( _ ) character
* names may not begin with a numeric character
* note that the set of legal characters draws from the entire Unicode character set
* also note that it is probably impossible to write a succinct set of rules about what are valid characters, other than to say a character, that when passed to Character.isJavaIdentifierPart(char ch), results in a true value
The compiler parses your code by separating it into individual entities:
* names (of classes, variables, and methods)
* command keywords
* single or compound symbols (compound symbols are when an operation is signified by a two-symbol combination)
* these entities are called tokens or symbols in computer science jargon
Tokens may be separated by spaces, tabs, carriage returns, or by use of an operator (such as +, -, etc.)
* since names may not contain spaces, tabs, or carriage returns, or operator characters, these characters imply a separation of what came before them from what comes after them
Extra whitespace is ignored
* once the compiler knows that two items are separate, it ignores any additional separating whitespace characters (spaces, tabs, or carriage returns)
|
Facebook