Java as a free form language: Whitespaces, Identifiers and Literals

Java is a free form language. There is no particular indent style in Java that needs to be followed specifically. Although, you have to make sure that, keywords, identifiers, literals, operators, and separators are clearly defined by using whitespaces. Whitespaces could be space, tab, or newline.

Identifiers: In Java, identifier is used for naming class names, variable names or method names. Identifier can contain numbers, uppercase, letters, lowercase letters, underscores and dollar sign. However, you have to make sure that they should not start with numbers. Apart from the things described above you cannot use any other symbol in an identifier. For Example: b2, $process

Literals: Literal is a constant value in Java program. It could be integer, floating point number, any other constant, or a string. For Example: 20, “More Process”

Leave a Reply