appendCodePoint(): This method is available in java.lang.StringBuilder class of Java.
Syntax:
StringBuilder java.lang.StringBuilder.appendCodePoint(int codePoint)
This method takes one argument of type int as its parameter. This method appends the string representation of the codePointargument 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:
StringBuilder str = new StringBuilder("Hello World")
int codePoint = 'h'
str.appendCodePoint(codePoint ) = > It returns Hello Worldh.
Approach
Java
public class AppendCodePoint {public static void main(String[] args) {StringBuilder str = new StringBuilder("Hello World");int codePoint = 'h';System.out.println(str.appendCodePoint(codePoint));}}
Output:
Hello Worldh
No comments:
Post a Comment