Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which emoji can be used as variables in Java, visible in Eclipse?

Tags:

java

eclipse

This question might be related to today's XKCD.

I discovered today that emoji could be used in variable names.

int ಢ_ಢ = 42; //apparently something valid 

Out of curiosity, is there a list of such special characters which can be used in Java, and in a way which is readable by Eclipse?

like image 645
Gnoupi Avatar asked Apr 17 '15 10:04

Gnoupi


People also ask

Can Emojis be variable names in Java?

"Any emoji which is standard in the unicode character set will be a valid variable name in Java" This is just an incorrect statement. The only way you could make it technically correct would be to change "will" to "will not".

Can you use Emojis as variables?

Users can not only use an emoji as a variable name but it can also be used as an alias in the import statement. In this article, you'll learn how to write code using emoji and execute it. Along with this, you'll also see how the code is translated to be understood by the python interpreter.

What symbols are allowed in Java variables?

Variable names are case-sensitive. A variable's name can be any legal identifier — an unlimited-length sequence of Unicode letters and digits, beginning with a letter, the dollar sign " $ ", or the underscore character " _ ".

Can you use Emojis in Java?

emoji-java is a lightweight java library that helps you use Emojis in your java applications.


1 Answers

Even if Java allows to use characters from the entire Unicode set it seems like Eclipse only allows a few.

Since I couldn't find a list of supported emojis I tried it out myself and found the following as working:

☺❤☝✌☀☁❄✈☎✉✂✒✏㊙㊗❇✳✴♈♉♊♋♌♍♎♏♐♑♒♓▶◀➡↗↘↙↖↕↔↪↩⤴⤵〰✖✔™©®〽‼⁉Ⓜ♨ ♠♣♥♦☑▪▫☹♤♡♢♧☢☣☠☤†☯☮☭☥✠✙✞✟✧⋆★☆✪✫✬✭✮✯✰✡☫☬☸✵❂❀❃❁✼♫♪☃❅❆☂❦♕♛♔♖♜☾ →⇒⇨➩➪➫➬➭➮➯➲➳➵➸➻➺➼➽☜☟➹➷↶↷✆⌘⏎❥ツღ☻` 

If you find more feel free to edit my answer and add them.

EDIT: I think there are now a lot more supported emojis than back then. You can also use thousands of letters from the chinese alphabet.

like image 82
das Keks Avatar answered Sep 21 '22 17:09

das Keks