For a variable name to be valid, it must follow Java identifier rules.
- [Instructor] In Java, identifiers are names.…They can be names of variables, classes,…interfaces, or members of classes or interfaces.…For the exam, you'll need to be able…to identify valid identifiers.…There are three rules.…It must begin with a letter, dollar symbol, or underscore.…It cannot use special symbols…other than dollar sign or underscore,…and they cannot be Java reserved words.…
Let's practice applying those rules.…Which of the following do you think are valid identifiers?…The valid ones are on the left.…They are valid because they don't violate any of the rules.…Let's examine the invalid ones.…1infiniteLoop starts with a number, and that's the problem.…Int is a Java reserved word with a special meaning.…[email protected] uses the at symbol, which is not allowed at all.…
So make sure you study identifier rules before your exam.…
Released
2/8/2019- Data types
- Allowable operations
- Literals and primitives
- Prefixes and suffixes
- Reference types
- Identifier rules
- Conversions
- Casting
Share this video
Embed this video
Video: Java identifiers