Computer Science, asked by ghjygfyg, 1 year ago

What are the rules for naming a variable in java?

Answers

Answered by Anonymous
4

Variables in Java Programming is something that can be changed, such as a characteristic or value. If we consider programming concept then we can say that variable is something which can store a value. It is container for storing a value.Variable name may be given by programmer.

Some Rules of Variable Naming Convention :

Variable names are case-sensitive.

A variable’s name can be any legal identifier.

It can contain Unicode letter,Digits and Two Special Characters such as Underscore and dollar Sign.

Length of Variable name can be any number.

Its necessary to use Alphabet at the start (however we can use underscore , but do not use it )

Some auto generated variables may contain ‘$‘ sign. But try to avoid using Dollar Sign.

White space is not permitted.

Special Characters are not allowed.

Digit at start is not allowed.

Subsequent characters may be letters, digits, dollar signs, or underscore characters.

Variable name must not be a keyword or reserved word.

Similar questions