Card 28 / 76: Consider the following declarations. Which declaration has an element name that does not conform to standard naming conventions?
A)
static final int varName; // variable
B)
Integer IntName; // variable
C)
void getName () {…} // method
D)
public class Name {…} // class
Answer:
B) Integer IntName; // variable
Previous Card | ← Previous Card Button |
Next Card | → Next Card Button |
Flip Card | Space-Bar |
All variables should start with a lowercase letter—thus, IntName should read intName.
A, C, and D are incorrect because they make use of the proper naming conventions.
Variable and method names should appear in all lowercase characters, using camel case where
appropriate. Class, interface, and enumeration names should start with an uppercase character, followed by lowercase characters and camel case where appropriate. Note that “camel case” refers to the capitalization of the first letter of appropriate words within an identifier.
|