File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes variable declaration in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Meteor in Action this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "variable declaration in java" Watch "variable declaration in java" New topic

variable declaration in java

saravana sankar

Joined: Oct 21, 2002
Posts: 1
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
so pls. give explanation.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
This has nothing to do with Java News so I will move this to... hmmmm....
Java In Genral (Intermediate).

Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Dave Landers
Ranch Hand

Joined: Jul 24, 2002
Posts: 401
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
I agree. Here's the link:
subject: variable declaration in java