Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Naming restrictions of variables in java

Tags:

java

Why are special characters (except $, _) not allowed in Java variable names?

like image 238
NPKR Avatar asked Oct 12 '12 10:10

NPKR


1 Answers

The following code is all valid in Java...

int Δ = 1;
double π = 3.141592;
String 你好 = "hello";
Δ++;
System.out.println(Δ);

I'd say those are pretty special characters for variable names.

Source : http://rosettacode.org/wiki/Unicode_variable_names#Java

like image 69
david99world Avatar answered Nov 12 '22 23:11

david99world