Sunday 17 March 2013

SCJP - 4 -Which are valid declarations? (Choose all that apply.)


4. Which are valid declarations? (Choose all that apply.)

A. int $x;
B. int 123;
C. int _123;
D. int #dim;
E. int %percent;
F. int *divide;
G. int central_sales_region_Summer_2005_gross_sales;

Answer:

A, C, and G are legal identifiers.
B is incorrect because an identifier can't start with a digit.
D, E, and F are incorrect because identifiers must start with $, _, or a letter. (Objective 1.3)

No comments:

Post a Comment