Questions and CORRECT Answers
First Identifier Rule - CORRECT ANSWER✔✔- 1. A java identifier must begin with a letter
of English alphabet ( a Non- English Letter, an underscore, $ sign is not allowed and class
name cannot begin with a digit).
Second Identifier Rule - CORRECT ANSWER✔✔- 2. A Java identifier can contain only
letters, digits, underscores, or dollar signs.
Third Identifier Rule - CORRECT ANSWER✔✔- 3. A Java identifier cannot be one of the
following values : true, false , or null. These are not keywords ( They are primitive values),
but they are reserved and cannot be used)
Valid class names in Java - CORRECT ANSWER✔✔- Employee - Begins with an uppercase
letter
UnderGradStudent- Begins with an upper case letter , contains no spaces, and emphasizes
each new word with an initial upper case letter.
InventoryItem- Same instance as previous example
Budget2016- Begins with an uppercase letter and contains no spaces
Legal but unconventional class names in Java - CORRECT ANSWER✔✔-
Undergradstudent- First letter is upper case but does not indicate other words with uppercase
letter
Inventory_Item - underscore is not commonly used to indicate new words
BUDGET2016- Using all upper case is unconventional
budget2016- class names ,conventionally, do not start with lower case letter
, Illegal Class Names in Java - CORRECT ANSWER✔✔- Inventory Item- Space character is
illegal in an identifier
Class- Is a reserved word
2016Budget- Class names cannot begin with a digit
phone#- The number symbol (#) is illegal in an identifier
Pascal Casing - CORRECT ANSWER✔✔- The style that joins words in which each word
begins with an uppercase letter
Public - CORRECT ANSWER✔✔- Is an access specifier
Class - CORRECT ANSWER✔✔- The keyword Class identifies a method as a class
Curly Braces { } - CORRECT ANSWER✔✔- Everything between curly braces is the class
body
Whitespace - CORRECT ANSWER✔✔- Is any combination of nonprinting characters
Static - CORRECT ANSWER✔✔- Means this method works without instantiating an object
of the class
Void - CORRECT ANSWER✔✔- is a method return type that returns nothing
String - CORRECT ANSWER✔✔- Is a class. Any Arguments to this method must be String
objects