Java Reference
In-Depth Information
You can put comments at the end of this line as follows:
System.out.println("7 + 8 = " + (7 + 8)); //prints: 7 + 8 = 15
This comment could be meaningful for a beginning programmer.
Multiple-line comments are enclosed between /* and */ . The compiler ignores
anything that appears between /* and */ . For example, the following is an example of
a multiple-line comment:
/*
You can include comments that can
occupy several lines.
*/
Special Symbols
The following are some of the special symbols:
+ - * /
. ; ? ,
<= != == >=
The first row includes mathematical symbols for addition, subtraction, multiplication, and
division. The second row consists of punctuation marks taken from English grammar.
Note that the comma is a special symbol. In Java, commas are used to separate items in a
list. Semicolons are used to end a Java statement. The third row contains symbols used for
comparisons. Note that a blank, which is not shown above, is also a special symbol. You
create a blank symbol by pressing the spacebar (only once) on the keyboard. The third
row consists of tokens made up of two characters, but which are regarded as single
symbols. No character can come between the two characters in these symbols, not even a
blank.
Reserved Words (Keywords)
A second category of tokens is reserved words. Some reserved words include the
following:
int , float , double , char , void , public , static , throws , return
Reserved words are also called keywords. The letters in a reserved word are always
lowercase. Like the special symbols, each reserved word is considered a single symbol.
Furthermore, reserved words cannot be redefined within any program; that is, they
cannot be used for anything other than their intended use. For a complete list of reserved
words in Java, see Appendix A.
Throughout this topic, the reserved words are shown in blue .
 
 
 
Search WWH ::




Custom Search