appendCodePoint(): This method is available in java.lang.StringBuffer class of Java.
Syntax:
StringBuffer java.lang.StringBuffer.appendCodePoint(int codePoint)
This method takes one argument of type int as its parameter. This method appends the string representation of the codePoint argument to this sequence. The argument is appended to the contents of this sequence.
Parameters: One parameter is required for this method.
codePoint: a Unicode code point.
Returns: a reference to this object.
For Example:
StringBuffer str = new StringBuffer("Hello World")
int codePoint = 'h'
str.appendCodePoint(codePoint) = > It returns Hello Worldh.
Approach
Java
public class AppendCodePoint {public static void main(String[] args) {StringBuffer str = new StringBuffer("Hello World");int codePoint = 'h';System.out.println(str.appendCodePoint(codePoint));}}
Output:
Hello Worldh
No comments:
Post a Comment