Java Terminology and Syntax
Statement:
A programming statement performs a piece of programming action. It must be terminated by a semi-colon (;) (just like an English sentence is ended with a period) as in Lines 6 in tutorials .
Block:
A block is a group of programming statements enclosed by braces { }. This group of statements is treated as one single unit. There are two blocks in this program. One contains the body of the class Hello. The other contains the body of the main() method. There is no need to put a semi-colon after the closing brace.
Comments:
A multi-line comment begins with /* and ends with */. An end-of-line comment begins with // and lasts till the end of the line. Comments are NOT executable statements and are ignored by the compiler. But they provide useful explanation and documentation. Use comments liberally.
Whitespaces:
Blank, tab, and newline are collectively called whitespace. Extra whitespaces are ignored, i.e., only one whitespace is needed to separate the tokens. But they could help you and your readers better understand your program. Use extra whitespaces liberally.
Case Sensitivity:
Java is case sensitive - a ROSE is NOT a Rose, and is NOT a rose. The filename is also case-sensitive.
No comments:
Post a Comment