Comment,Semicolons, Blocks,White Space and Identifier are using in java

0




Comments

The three permissible styles for inserting comments are:
// comment on one line
/* comment on one
* or more lines
*/
/** documentation comment
* can also span one or more lines
*/

Documentation comments placed immediately before a declaration (of a variable, method, or class) indicate that the comments should be included in any documentation that is generated automatically (for example, the HTML files generated by the javadoc command) to serve as a description of the declared item.

download

Semicolons, Blocks, and White Space

In the Java programming language, a statement is one or more lines of code terminated with a semicolon (;).
For example,
totals = a + b + c + d + e + f;

is the same as

totals = a + b + c
+ d + e + f;

A block, sometimes called a compound statement, is a group of statements bound by opening and closing braces ({ }). A block has useful features that are described in Module 4, “Expressions and Flow Control.” For now, just think of a block as a group of statements that are collected together.
The following are other examples of block statements or groupings:

// a block statement
{
x = y + 1;
y = x + 1;
}
// a class definition is contained in a block
public class MyDate {
private int day;
private int month;
private int year;
}
// a block statement can be nested within
// another block statement
while ( i < large ) {
a = a + i;
// nested block
if ( a == max ) {
b = b + a;
a = 0;
}
i = i + 1;
}

You can have white space between elements of the source code. Any amount of white space is allowed. You can use white space, including spaces, tabs, and new lines, to enhance the clarity and visual appearance of your source code.

Compare:
{int x;x=23*54;}
with:
{
int x;
x = 23 * 54;
}
Identifiers
In the Java programming language, an identifier is a name given to a variable, class, or method. Identifiers start with a letter, underscore (_), or dollar sign ($). Subsequent characters can be digits. Identifiers are case-sensitive and have no maximum length.

The following are valid identifiers:
● identifier
● userName
● user_name
● _sys_var1
● $change

Java technology sources are in 16-bit Unicode rather than 8-bit American Standard Code for Information Interchange (ASCII) text, so a letter is a considerably wider definition than just a–z and A–Z. While identifiers can use non-ASCII characters, be aware of the following caveats:
● Unicode can support different characters that look the same.
● Class names should only be in ASCII characters because most file systems do not support Unicode characters.
An identifier cannot be a keyword, but it can contain a keyword as part of its name. For example, thisOne is a valid identifier, but this is not because this is a Java technology keyword.
Note – Identifiers containing a dollar sign ($) are generally unusual, although languages such as BASIC, along with VAX/VMS systems, make extensive use of them. Because they are unfamiliar, it is probably best to avoid them unless there is a local convention or other pressing reason for including this symbol in the identifier.