java reserved words tutorial

Bodhak java reserved words tutorial in this chapter we are going to discuss in detail about Java Reserved Words, Identifiers of Java, Naming rules, Constants /literals, Data types along with syntax’s ad examples.

Reserved words have specific meanings in Java and cannot be used in other ways. the list of reserved words is discussed in details in Java Tutorial Reserved words.

 

java reserved words tutorial

Examples for reserved words are the default, do, double, else, extends, false, final, finally etc..

Identifiers and Naming conventions:

An identifier is a sequence of one or more characters.

An identifier is a name given to a package, class, interface, method, or variable. It allows a programmer to refer to the item from other places in the program.

Three things to remember when choosing an identifier:

Reserved word cannot be used.

They cannot start with a digit but digits can be used after the first character (e.g., name1, n2ame are valid).

The only symbols you can use are the underscore (i.e., “_”) and dollar sign (i.e., “$”).

Class names should be nouns in Upper Camel Case, with the first letter of every word capitalized. Use whole words — avoid acronyms and abbreviations (unless the abbreviation is much more widely used than the long form, such as URL or HTML).

Methods should be verbs in Lower Camel Case or a multi-word name that begins with a verb in lowercase; that is, with the first letter lowercase and the first letters of subsequent words in upper case.

Local variables, instance variables, and class variables are also written in lower CamelCase. Variable names should not start with an underscore (_) or dollar sign ($) characters, even though both are allowed.

Constants should be written in uppercase characters separated by underscores. Constant names may also contain digits if appropriate, but not as the first character.

A variable is an identifier that represents a location in memory that holds a particular type of data

Identifiers are the names we give to variables.

Variables must be declared before they can be used