fork(1) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. // GOOD
  13.  
  14. System.out.println( Character.toString( 65 ) ) ; // "A"
  15.  
  16. String faceWithMedicalMask = Character.toString( 128_567 ) ;
  17. System.out.println( faceWithMedicalMask ) ; // "😷" = FACE WITH MEDICAL MASK.
  18.  
  19. char c = (char) 66 ; // "B"
  20. System.out.println( c ) ;
  21.  
  22. // BAD
  23.  
  24. // The `char` type is limited to a range of 0 to 65,535.
  25. char d = (char) 65_666 ; // "𐂂" = LINEAR B IDEOGRAM B104 DEER.
  26. System.out.println( "char of 65_666 is: " + d ) ;
  27.  
  28. char e = (char) 127_881 ; // "😷" = FACE WITH MEDICAL MASK.
  29. System.out.println( "char of 127_881 is: " + e ) ;
  30. }
  31. }
Success #stdin #stdout 0.09s 47932KB
stdin
Standard input is empty
stdout
A
😷
B
char of 65_666 is: ‚
char of 127_881 is: 