Basic Syntax


Much of the basic syntax between Java and C++ is the same. Both languages do things like end executable statements in a semicolon, start array indices from 0, and so on. But there are some important differences. For example, other than the + operator that is used to add numbers and concatenate strings, Java does not support operator overloading. Eliminating operator overloading was done to simplify the language. In Java, the functionality of operator overloading can be achieved by defining appropriate methods . Java does not define the delete operator.

Java does not have a goto statement. This construct was probably the most hated and misused programming syntax of all time, so Java simply eliminated it. What's more, Java made goto a reserved word so it couldn't be used at all. To exit from a block of code, Java uses the break and continue statements. The break and continue statements can be labeled to exit a labeled block of code. This feature can be used to break out of an outer block of code from an inner block.



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