Pages

Search

 

31 July 2009

[JAVA] Java Programming Language Syntax

The syntax of Java is largely derived from C++. Unlike C++, which combines the syntax for structured, generic, and object-oriented programming, Java was built almost exclusively as an object oriented language. All code is written inside a class and everything is an object, with the exception of the intrinsic data types (ordinal and real numbers, boolean values, and characters), which are not classes for performance reasons.

Java suppresses several features (such as operator overloading and multiple inheritance) for classes in order to simplify the language and to prevent possible errors and anti-pattern design.

Java uses the same commenting methods as C++. There are two different methods of commenting, the first is generally used for single line comments // two forward slashes and the second is generally used for multiple line commenting, this requires an open and close. In order to use the second method of commenting you must use the forward slash asterisk (/*) and it must end with an asterisk forward slash (*/)

//This is an example of a single line comment using two forward slashes
/* This is an example of a multiple line comment using the forward slash
and asterisk. This type of comment can be used to hold a lot of information
but it is very important to remember to close the comment. */

No comments: