How do I put emojis in java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do I put emojis in java?

It's my fourth day learning and I saw someone else do it but I really want to learn how to do it how should I go about putting an emoji in my Java script "Starbucks slap."? (I know it's a very weird request but I'm bored) https://code.sololearn.com/c6zHyeFHfS2k/?ref=app

25th Feb 2022, 4:49 PM
ruby fireleader
4 Answers
+ 5
You can either look up the character code of the emoji or copy it from somewhere else into the string: https://code.sololearn.com/cpJIK1UA2iiK/?ref=app
25th Feb 2022, 4:57 PM
Lisa
Lisa - avatar
+ 3
Unicode is your friend mate. The Wikipedia page has a fairly complete list.
25th Feb 2022, 8:26 PM
Ausgrindtube
Ausgrindtube - avatar
+ 2
In C I had to make sure I was treating them as a multiple character char, not just a single letter. So they needed to be an array type. PS: I like option "4" the best! Your code looks like you are outputting string constants between quotes, so you should be able to paste them straight in. https://code.sololearn.com/cME89b80H4iP/?ref=app
25th Feb 2022, 10:07 PM
HungryTradie
HungryTradie - avatar
+ 2
String context = "You can eat water too! "; context += new String(Character.toChars(0x1F349));
27th Feb 2022, 4:33 AM
Vaibhav
Vaibhav - avatar