• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Queries related to K&B SCJP 6 book

 
Ranch Hand
Posts: 102
Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I have some queries related to the legal identifiers specified in the K&B SCJP 6 book (Page 5 under Legal Identifiers). In this page, they have given some examples of illegal identifiers. Can you please help me understand, why the below is considered as illegal identifier.




As per the explanation provided, it states that Identifiers must start with a letter, a currency character ($), or a connecting
character such as the underscore ( _ ). Identifiers cannot start with a number. In the above case, the identifier starts with a letter 'e'. But not sure why it is considered as illegal identifier. Please explain.

Thanks in advance
 
Marshal
Posts: 79704
381
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should find the explanation in the Java Language Specification.
 
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Varshini,

In addition to the starting character restriction, the SCJP book also tells you that a legal identifier should only consist of a combination of either a letter, a $, a number or a connecting character. In your example, '#' is not a connecting character. Please go through the JLS link in the post above for complete details.
 
This tiny ad will self destruct in five seconds.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic