Title
Question
Java Numerical-Datatypes 06-07 min 40-50 sec
Answers:
1. Only allowed characters for java identifiers are a to z, A to Z, 0 to 9, _, $. If we are using any other character, compile time error will be thrown by compiler.<o:p></o:p>
2. Identifiers can’t start with digits.<o:p></o:p>
3. Java identifiers are case sensitive. Java language is considered as case sensitive programming language.<o:p></o:p>
4. There is no length limit for java identifiers, but it is not recommended to take too lengthy identifiers.<o:p></o:p>
5. We can’t use reserved word as identifiers.<o:p></o:p>
6. All predefined java class names and Interface names can be used as identifiers. Ex. String, Runnable. Even though it is valid, it is not good programming practice, as it reduces readability and creates confusion.<o:p></o:p>
Login to add comment
Names must start with a letter. Use only letters, digits or the underscore ( _ ) in the rest of the name.
Don’t start with a numbers or use special characters ($,%,@)
Separate words with ‘camelHump’ notation
Variable names are case-sensitive
Don’t use reserved ‘Java’ words
Variables start with lower case, class names with upper case (by convention, not a ‘rule’)
<span style="font-size:1.00em;">1. Cannot start with a digit</span>
<span style="font-size:1.00em;">2. Can contain letters, digits, dollar signs, and underscores. </span>
<span style="font-size:1.00em;">3.Cannot use Java reserved keywords. </span>
<span style="font-size:1.00em;">4.Variable names cannot contain spaces.</span>
<span style="font-size:1.00em;">
</span>
<span style="font-size:1.00em;">
</span>
Login to add comment