when we need to use one character and dealwith it we use primitive data types char.
char ch = 'a'; // Unicode for the arrow ↘ as character char uniChar = '\u2198'; // an array of chars char[] charArray ={ 'a', 'b', 'c', 'd', 'e' };
in development, we come across some situations where we need to use objects instead of primitive data types. In order to achieve this, Java provides wrapper class Character for primitive data type char. beoutq.
The Character class offers a number of useful class (i. لعب اون لاين e., static) methods for manipulating characters. You can create a Character object with the Character constructor:
Character ch = new Character('a');
The Java compiler will also create a Character object for you under some circumstances. For example, if you pass a primitive char into a method that expects an object, the compiler automatically converts the char to a Character for you. payeer bank This feature is called autoboxing—or unboxing, if the conversion goes the other way.
Leave a Reply