-4

Please let me explain that # can not use in java identifier. For example. int e#;

And also, let me know that # is used in java and where to use?

Eido Shack
  • 65
  • 2
  • 11
  • 3
    Is there any point to this question? Why are you concerned about `#` specifically? – Martin Smith Feb 07 '13 at 15:02
  • 1
    every programming language has its syntax. Simply it works this way. As well as you can't have variable like `int 1d;` try to live with that :) – CsBalazsHungary Feb 07 '13 at 15:05
  • 1
    I'm not sure about a usage in Java, but in [javadoc](http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#multiple@see) the # is used to separate Classes and the member Field/methods. – Charlie Feb 07 '13 at 15:11
  • I'd advice against using this except for purposes of amusement. But you can use *all* unicode "letters" in a Java identifier, including ones that merely look like a hash-sign. So this is valid: `int c井 = 5;` – Erwin Bolwidt Oct 23 '15 at 04:39

2 Answers2

4

Because it's not a valid symbol in the language. Just as you can't do:

int HELLO+*/\Variable;

See 3.8. Identifiers in the Java specification:

An identifier is an unlimited-length sequence of Java letters and Java digits, the first of which must be a Java letter.

http://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.8

Darren
  • 68,902
  • 24
  • 138
  • 144
3

I think you need to read this:

http://docs.oracle.com/javase/tutorial/java/nutsandbolts/variables.html

Ask Oracle afterwards, if you still don't know!

Bob Flannigon
  • 1,204
  • 9
  • 8