Java Tut – Character Class

Some escape sequence here :
\t,\b,\n,\r,\f,\’,\”,\\
example:

public class Escape {
public static void main(String[] args)
{
	System.out.println("She said \"Hello\" to me");
}
}

output:

She said "Hello" to me

The character class offers a number of useful class(i.e: static) methods for manipulating characters.You can create character object with the Character constructoir:

Character ch=new Character('a');

we normally use primitive though:
char ch=’a’;
Unicode for uppercase greek omega letter
char cunicode=’\u039A’;
char c=’test(‘x’);
Character methods:
Here is the list of the important intance  methods taht all subclasses of t

the character class implement
:
those are available in java.lang
Character Class isLetter(“c”),isDigit(“5”),
Character.isWhiteSpace(‘\n’);
Character.isWhitespace(‘\t’);

String toString(char ch)
ch — primitve character type
the method returns a string object representing the speciifed character value, that is, a one character string.
Character.toString(‘c’);
Character.toString(‘C’);
result:
c
C

 

It would be a great help, if you support by sharing :)
Author: zakilive

Leave a Reply

Your email address will not be published.