Basic Syntax


As mentioned before, Java is a C-based language and much of the basic syntax is the same. Both languages allow you to indent statements any way you like. Indentation is largely used to make code more readable. Both languages end statements with a semicolon. Braces are used to delimit blocks of code.

The mathematical, relational, assignment, and boolean operators are the same in Java and C. In addition to mathematical addition, Java uses the + operator to concatenate strings. Java does not use the address operator ( & ), dereference ( * ), or struct access ( -> ) operators because it does not support publicly accessible pointers. Java and C use the same types of loop and flow control structures including if-else , while , do-while , for , and switch statements. Java also has the transfer of control statements return , break , and continue .



Technical Java. Applications for Science and Engineering
Technical Java: Applications for Science and Engineering
ISBN: 0131018159
EAN: 2147483647
Year: 2003
Pages: 281
Authors: Grant Palmer

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net