• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why variable names can't start with numericals

 
nitin kanwar
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was asked in an interview as to why the variable names can't start with a numerical value ? To be more precise the interviewer wanted to know the lexical / compilation problems associated with declaring a variable name that starts with a numerical ?

Answers will be appreciated.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch

think about this:

int 2L = 100;
long value = 2L;//what is the value of value variable?

and

int 4L = 200;
System.out.println(4L);//???


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic