New Tutorials:   JAVASCRIPT    SASS/SCSS    PL/SQL  
See the Tutorial List

Character class


Below are the Methods of Character class and their example.

1. booleanisLetter(char ch)

Syntax:

	
1. booleanisLetter(char ch) 
	

Example:

	
public class CharacterDemo1
{ 
    public static void main(String[] args) 
    { 
		System.out.println(Character.isLetter('S'));  

		System.out.println(Character.isLetter('9'));     
     } 
}
	

character-class-example


2. booleanisDigit(char ch)

Syntax:

	
booleanisDigit(char ch)
	

Example:

	
public class CharacterDemo1
{ 
    public static void main(String[] args) 
    { 
		System.out.println(Character.isDigit('S'));  

		System.out.println(Character.isDigit('9'));     
     } 
}
	

character-class-example


3. booleanisWhitespace(char ch)

Syntax:

	
booleanisWhitespace(char ch)
	

Example:

	
public class CharacterDemo1
{ 
    public static void main(String[] args) 
    { 
		System.out.println(Character.isWhitespace('S'));  
		System.out.println(Character.isWhitespace(' '));  
		System.out.println(Character.isWhitespace('\n'));  
		System.out.println(Character.isWhitespace('\t'));   
		System.out.println(Character.isWhitespace(5)); 
		System.out.println(Character.isWhitespace('5'));     
     } 
}
	

character-class-example


4. booleanisUpperCase(char ch)

Syntax:

	
booleanisUpperCase(char ch)
	

Example:

	
public class CharacterDemo1
{ 
    public static void main(String[] args) 
    { 
		System.out.println(Character.isUpperCase('S')); 
		System.out.println(Character.isUpperCase('s')); 
		System.out.println(Character.isUpperCase(89));      
     } 
}
	

character-class-example


5. booleanisLowerCase(char ch)

Syntax:

	
booleanisLowerCase(char ch)
	

Example:

	
public class CharacterDemo1
{ 
    public static void main(String[] args) 
    { 
	System.out.println(Character.isLowerCase('S'));  
	System.out.println(Character.isLowerCase('s'));  
	System.out.println(Character.isLowerCase(46));    
     } 
}
	

character-class-example


6. char toUpperCase(char ch)

Syntax:

	
char toUpperCase(char ch)
	

Example:

	
public class CharacterDemo1
{ 
    public static void main(String[] args) 
    { 
	System.out.println(Character.toUpperCase('s'));  
	System.out.println(Character.toUpperCase(45));  
	System.out.println(Character.toUpperCase(12)); 
     } 
}
	

character-class-example


7. char toLowerCase(char ch)

Syntax:

	
7. char toLowerCase(char ch)
	

Exmaple:

	
public class CharacterDemo1
{ 
    public static void main(String[] args) 
    { 
	System.out.println(Character.toLowerCase('S'));  
	System.out.println(Character.toLowerCase(45));  
	System.out.println(Character.toLowerCase(12));
     } 
}
	

character-class-example


8. toString(char ch)

Syntax:

	
String toString(char ch)
	

Example:

	
public class CharacterDemo1
{ 
    public static void main(String[] args) 
    { 
	System.out.println(Character.toString('S'));  
	System.out.println(Character.toString('a'));  
     } 
}
	

character-class-example


9. static intcharCount(intcodePoint)

Syntax:

	
public static intcharCount(int code)
	

Example:

	
public class CharacterDemo1
{ 
    public static void main(String[] args) 
    { 
int a = 0x9001; 
int b = Character.charCount(a); 
System.out.println(b);   
     } 
}
	

character-class-example


10. char charValue()

Syntax:

	
public char charValue()
	

Example:

	
public class CharacterDemo1
{ 
    public static void main(String[] args) 
    { 
Character a = new Character('a'); 
        char b = a.charValue(); 
System.out.println(b);   
     } 
}
	

character-class-example