Java Char Create toChar(Object obj)

Here you can find the source of toChar(Object obj)

Description

Get the char value of this object, only if the object is an instance of Character

License

Open Source License

Parameter

Parameter Description
obj the object to be converted

Return

the char value of the object, or '\u0000' if it is not a character.

Declaration

public static char toChar(Object obj) 

Method Source Code

//package com.java2s;

public class Main {
    /**/*from w  ww .j  av a2  s  . c  o  m*/
     * Get the char value of this object, only if the object is an instance of Character
     *
     * @param obj the object to be converted
     * @return the char value of the object, or '\u0000' if it is not a character.
     */
    public static char toChar(Object obj) {
        return (obj instanceof Character) ? ((Character) obj).charValue() : '\u0000';
    }
}

Related

  1. toChar(int i)
  2. toChar(int i)
  3. toChar(int var)
  4. toChar(int[] arr)
  5. toChar(int[] arr)
  6. toChar(Object value)
  7. toChar(short o)
  8. toChar(String chars)
  9. toChar(String delimiter)