• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Illegal Identifiers

 
Ranch Hand
Posts: 144
Netbeans IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey folks !

could any one please tell me why the following identifiers are illegal?


if possible give the reason for each of them seperately,,, like i've done for the last one. ,, thanks in advance
 
Ranch Hand
Posts: 114
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Hama Kamal

Identifier can starts with only $, _ and letters. Its the Rule of Identifier. I think no explanation is need here, its the rule and rule and nothing and also like we can't use identifier as a variable name.



 
Ranch Hand
Posts: 148
Hibernate Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just a minor correction to statement



Identifier can starts with only $, _ and letters



Identifier can starts with only any currency symbol, _ and letters
 
Aashu Mahajan
Ranch Hand
Posts: 114
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Vijay Tidake

Ya you are right, Thanks
 
Hama Kamal
Ranch Hand
Posts: 144
Netbeans IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Vijay Tidake wrote:Just a minor correction to statement



Identifier can starts with only $, _ and letters



Identifier can starts with only any currency symbol, _ and letters





Identifiers must start with a letter, a currency character ($), or a connecting
character such as the underscore ( _ ) ,, what other connecting characters are? that is my point?!
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hama Kamal wrote:

Vijay Tidake wrote:Just a minor correction to statement



Identifier can starts with only $, _ and letters



Identifier can starts with only any currency symbol, _ and letters





Identifiers must start with a letter, a currency character ($), or a connecting
character such as the underscore ( _ ) ,, what other connecting characters are? that is my point?!



Hi as far as I am aware the only connecting character allowed is the underscore (_)
Other such as dot(.) and dash(-) are not regarded as connecting characters in java as they have other meaning.
 
Hama Kamal
Ranch Hand
Posts: 144
Netbeans IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

kawshik java wrote:

Hama Kamal wrote:

Vijay Tidake wrote:Just a minor correction to statement



Identifier can starts with only $, _ and letters



Identifier can starts with only any currency symbol, _ and letters





Identifiers must start with a letter, a currency character ($), or a connecting
character such as the underscore ( _ ) ,, what other connecting characters are? that is my point?!



Hi as far as I am aware the only connecting character allowed is the underscore (_)
Other such as dot(.) and dash(-) are not regarded as connecting characters in java as they have other meaning.



thanks for your reply my friend ...it helped
 
Saloon Keeper
Posts: 15555
364
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, there are some really interesting symbols allowed. Take a look at the Pc and Sc categories: http://www.dpawson.co.uk/xsl/rev2/UnicodeCategories.html.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
but what about the 3rd one ??
int e#
it starts with a letter
 
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think only letters, currency symbols, digits and the underscore (_) are allowed after the first character. In the K & B book it says "connecting characters" which is obviously only _ for the exam (see this thread).

John
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic