Java.lang.StringBuffer.appendCodePoint() Method

Advertisements


Description

The java.lang.StringBuffer.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.StringBuffer.appendCodePoint() method

public StringBuffer appendCodePoint(int codePoint)

Parameters

  • codePoint -- This is a 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.StringBuffer.appendCodePoint() method.

package com.tutorialspoint;

import java.lang.*;

public class StringBufferDemo {

  public static void main(String[] args) {
  
    StringBuffer buff = new StringBuffer("tutorials");
    System.out.println("buffer = " + buff);

    // appends the CodePoint as string to the string buffer
    buff.appendCodePoint(80);
    // print the string buffer after appendingCodePoint 80
    System.out.println("After appendCodePoint = " + buff);
  }
}

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

buffer = tutorials
After appendCodePoint = tutorialsP



Advertisements
Advertisements