• 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

variable declaration in java

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hai everyone,

In java I was surprised by the following coding.

class c1
{
public static void main(String a[])
{
int �;
� = 10;
System.out.println("The value is : " +�);
}
}
I thought that this will give an error but it is getting excecuted normally.
Any variable should start with an alphabet
or underscore or currrency.
But I am surprised to see that
the value between Alt-128 to Alt-158 also comes under this
category.
so pls. give explanation.
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This has nothing to do with Java News so I will move this to... hmmmm....
Java In Genral (Intermediate).
 
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
An identifier (variable) should start with a letter - including underscore (_) or dollar sign ($) - followed by letters or digits.
A "letter" uses the unicode definition, which includes lots of characters from many languages.
See javadoc for Character.isJavaIdentifierStart()
or the JLS section about identifiers
http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#40625
 
reply
    Bookmark Topic Watch Topic
  • New Topic