• Post Reply Bookmark Topic Watch Topic
  • New Topic

why int e# is illegal identifier?  RSS feed

 
Vishal Kurkure
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why int e# is illegal identifier?
 
Ganish Patil
Ranch Hand
Posts: 529
19
Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Netbeans IDE Spring Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
# is not allowed to use while naming a variable.

Rules for naming a variable:
  • Variable names mustn't be keyword or reserved word
  • Variable names are case-sensitive
  • A variable's name can have an unlimited-length sequence of Unicode letters and digits
  • Recommended to begin variable name with a letter then can have the dollar sign "$", or the underscore character "_" but better avoid using $ and _
  • Example: float interest_Rate; or interest$Rate but recommended int interestRate;
  • White space is not permitted.
  • Use full words for variable names like above example so anyone can understand what that variable is for
  • Don't use abbreviations like int c, a, b
  • If variable name has on word then write in small letter Example int age; else first word in small and subsequent in capital Example gearRatio and currentGear
  • If your variable stores a constant value then all letters in capital. If has two words in it then separate two words by underscore Example static final int NUM_GEARS = 6
  •  
    Vishal Kurkure
    Greenhorn
    Posts: 19
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thank you,
     
    Ganish Patil
    Ranch Hand
    Posts: 529
    19
    Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Netbeans IDE Spring Tomcat Server
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    You're most welcome
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!