Java.lang.StringBuilder.appendCodePoint() Method

Advertisements


Description

The java.lang.StringBuilder.appendCodePoint(int codePoint) method appends the string representation of the codePoint argument to this sequence.The argument is appended to the contents of this sequence.

Declaration

Following is the declaration for java.lang.StringBuilder.appendCodePoint() method

public StringBuilder appendCodePoint(int codePoint)

Parameters

  • codePoint -- This is the Unicode code point.

Return Value

This method returns a reference to this object.

Exception

  • NA

Example

The following example shows the usage of java.lang.StringBuilder.appendCodePoint() method.

package com.tutorialspoint;

import java.lang.*;

public class StringBuilderDemo {

  public static void main(String[] args) {
  
    StringBuilder str = new StringBuilder("programming");
    System.out.println("string = " + str);

    // appends the CodePoint as string to the StringBuilder
    str.appendCodePoint(74);
    
    // print the StringBuilder after appendingCodePoint 74
    System.out.println("After appendCodePoint = " + str);
  }
}

Let us compile and run the above program, this will produce the following result:

string = programming
After appendCodePoint = programmingJ



Advertisements
Advertisements