+ 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
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
+ 3
Unicode is your friend mate. The Wikipedia page has a fairly complete list.
+ 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
+ 2
String context = "You can eat water too! ";
context += new String(Character.toChars(0x1F349));