java.lang.Character isLowSurrogate(char ch)

Description

The Character.isLowSurrogate(char ch) java method determines if the given char value is a Unicode low-surrogate code unit (also known as trailing-surrogate code unit).

Such values do not represent characters by themselves, but are used in the representation of supplementary characters in the UTF-16 encoding.

 

The isLowSurrogate(char ch) method of Character class is static thus it should be accessed statically which means the we would be calling this method in this format:

Character.isLowSurrogate(char ch)

Non static method is usually called by just declaring method_name(argument) however in this case since the method is static, it should be called by appending the class name as suffix. We will be encountering a compilation problem if we call the java isLowSurrogate() method non statically.

Method Syntax

public static boolean isLowSurrogate(char ch)

Method Argument

Data Type Parameter Description
char ch the char value to be tested.

Method Returns

The isLowSurrogate(char ch) method of Character class returns true if the char value is between MIN_LOW_SURROGATE and MAX_LOW_SURROGATE inclusive; false otherwise.

Compatibility

Requires Java 1.5 and up

Java Character isLowSurrogate(char ch) Example

Below is a simple java example on the usage of isLowSurrogate(char ch) method of Character class.

package com.javatutorialhq.java.examples;

/*
 * This example source code demonstrates the use of 
 * isLowSurrogate(char ch) method of Character class.
 */

public class CharacterIsLowSurrogateExample {

	public static void main(String[] args) {
		/*
		 * Editors Note:
		 * Range is udc00 to udfff
		 */
		
		// initialize characters to be tested
		char c1 = 'udd10';
		char c2 = 'uf000';
		
		// check the characters if it is a Unicode low-surrogate code unit
		boolean result1 = Character.isLowSurrogate(c1);
		boolean result2 = Character.isLowSurrogate(c2);
		
		// print the result
		System.out.println("is c1 a Unicode low-surrogate code unit?"+result1);
		System.out.println("is c2 a Unicode low-surrogate code unit?"+result2);

		
	}

}

Sample Output

Below is the sample output when you run the above example.

java Character isLowSurrogate(char ch) example output