Java OCA OCP Practice Question 207

Question

Which of the following is not a valid class declaration?

A.   class building {} 
B.   class Cost$ {} 
C.   class 5MainSt {} 
D.   class _Outside {} 


C.

Note

Class names follow the same requirements as other identifiers.

Underscores and dollar signs are allowed.

Numbers are allowed, but not as the first character of an identifier.

Option C is correct.

class names begin with an uppercase letter by convention, but this is not a requirement.




PreviousNext

Related