Sunday, June 30, 2013

Display smiley face character in Java

Example to display smiley face character (☺) in Java:

Display smiley face character in Java
Display smiley face character in Java


package javaex_smileyface;

/**
 * @web http://java-buddy.blogspot.com/
 */
public class JavaEx_SmileyFace {

    public static void main(String[] args) {
        System.out.println('\u263A');
        System.out.println('☺');
    }
}


remark: Not all Operating Systems can display extended Unicode symbols, regardless of bundling the fonts with the programs. If it can't display the Unicode symbol, it displays a Square instead.

3 comments:

  1. Just be aware that not all Operating Systems can display extended Unicode symbols, regardless of bundling the fonts with the programs.

    If it cant display the Unicode symbol, it displays a Square instead. Hungarian is notorious for this.

    ReplyDelete
  2. its giving questionmark symbol. am using windows7 operating system.

    ReplyDelete