e Learning

Can Java Variables start with a number ?

NO!! Variable names in Java Cannot be started with a number. In Java Variables can only start with a Letter, Underscore (_) , or Dollar Sign ($).

You can include numbers anywhere after the first letter. But you still cannot use symbols such as @,*,& and etc..

Examples of Valid Java variable names

FirstName

firstName

$student

_month

student1

Examples of Invalid Java Variables

1student

@day

1_items