fork(2) download
  1. class Example
  2. {
  3. private static String toHex(int n) {
  4. return Integer.toString(n, 16).toUpperCase();
  5. }
  6.  
  7. public static void main (String[] args) throws java.lang.Exception
  8. {
  9. // String containing smiling face with smiling eyes emoji
  10. String str = "😊";
  11. // Get the code point
  12. int cp = str.codePointAt(0);
  13. // Show it
  14. System.out.println(str + ", code point = U+" + toHex(cp));
  15. // Increase it
  16. ++cp;
  17. // Get the updated string (from an array of code points)
  18. String updated = new String(new int[] { cp }, 0, 1);
  19. // Show it
  20. System.out.println(updated + ", code point = U+" + toHex(cp));
  21. }
  22. }
Success #stdin #stdout 0.09s 35976KB
stdin
Standard input is empty
stdout
😊, code point = U+1F60A
😋, code point = U+1F60B