Friday, November 14, 2025
HomeLanguagesJavaCharacter.isLowSurrogate() method in Java with examples

Character.isLowSurrogate() method in Java with examples

The java.lang.Character.isLowSurrogate(char ch) is an inbuilt method in java which 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.

Syntax:

public static boolean isLowSurrogate(char ch)

Parameters: The function accepts one mandatory parameter ch which specifies the character to be tested.

Return Value: The function returns a boolean value. The value returned is True if the char value is between MIN_LOW_SURROGATE and MAX_LOW_SURROGATE inclusive, False otherwise.

Below programs illustrate the Character.isLowSurrogate() method:

Program 1:




// Java program to illustrate the
// Character.isLowSurrogate() method
import java.lang.*;
  
public class gfg {
  
    public static void main(String[] args)
    {
  
        // create 2 char primitives c1, c2
        char c1 = '\udc25', c2 = 'h';
  
        // assign isLowSurrogate results of
        // c1, c2 to boolean primitives bool1, bool2
        boolean bool1 = Character.isLowSurrogate(c1);
        System.out.println("c1 is a Unicode low-surrogate ? " + bool1);
  
        boolean bool2 = Character.isLowSurrogate(c2);
        System.out.println(c2 + " is a Unicode low-surrogate ? " + bool2);
    }
}


Output:

c1 is a Unicode low-surrogate ? true
h is a Unicode low-surrogate ? false

Program 2:




// Java program to illustrate the
// Character.isLowSurrogate() method
import java.lang.*;
  
public class gfg {
  
    public static void main(String[] args)
    {
  
        // create 2 char primitives c1, c2
        char c1 = '\udc29', c2 = 'x';
  
        // assign isLowSurrogate results of
        // c1, c2 to boolean primitives bool1, bool2
        boolean bool1 = Character.isLowSurrogate(c1);
        System.out.println("c1 is a Unicode low-surrogate ? " + bool1);
  
        boolean bool2 = Character.isLowSurrogate(c2);
        System.out.println(c2 + " is a Unicode low-surrogate ? " + bool2);
    }
}


Output:

c1 is a Unicode low-surrogate ? true
x is a Unicode low-surrogate ? false

Reference: https://docs.oracle.com/javase/7/docs/api/java/lang/Character.html#isLowSurrogate(char)

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32399 POSTS0 COMMENTS
Milvus
95 POSTS0 COMMENTS
Nango Kala
6765 POSTS0 COMMENTS
Nicole Veronica
11917 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11984 POSTS0 COMMENTS
Shaida Kate Naidoo
6889 POSTS0 COMMENTS
Ted Musemwa
7141 POSTS0 COMMENTS
Thapelo Manthata
6837 POSTS0 COMMENTS
Umr Jansen
6840 POSTS0 COMMENTS