Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java reserved name compilation [duplicate]

Tags:

java

I have seen this cod, why it works please?

public void nеw() {
    System.out.println("!?");
}

It is compile in java, I think new is a reserved word

like image 947
mikkhaillavochikin335113 Avatar asked Jan 13 '15 21:01

mikkhaillavochikin335113


1 Answers

It is a cyrillic е, not a latin e. Therefore, it looks like new, but is actually a different method name.

Like NPE said, I would recommend reading is it a good idea to use unicode symbols as java identifiers?

like image 117
416E64726577 Avatar answered Sep 20 '22 18:09

416E64726577