java.lang.StringBuffer.appendCodePoint(int cp) is the method to append the string representation of the codePoint parameter to the sequence.
Syntax :
public StringBuffer appendCodePoint(int cp)
Parameters : This method accepts a single parameter cp of integer type and refers to a Unicode code point.
Return Value : The method returns this object after appending the string represented by the code point.
In Java, the StringBuffer class provides a method called appendCodePoint(), which is used to append the Unicode character represented by the specified code point to the end of the current sequence. The appendCodePoint() method takes an integer argument representing the Unicode code point of the character to be appended.
The syntax of the appendCodePoint() method is as follows:
public StringBuffer appendCodePoint(int codePoint)
Here's an example code that demonstrates the usage of the appendCodePoint() method:
StringBuffer str = new StringBuffer(); str.appendCodePoint(65); // Appends the character 'A' str.appendCodePoint(66); // Appends the character 'B' System.out.println(str.toString()); // Prints "AB"
In the above example, we create a new StringBuffer object and append two characters to it using the appendCodePoint() method. The first call to appendCodePoint() appends the character 'A', which has a Unicode code point of 65. The second call appends the character 'B', which has a Unicode code point of 66. Finally, we print the resulting string, which should contain the characters 'A' and 'B'.
It's important to note that the appendCodePoint() method is used to append a single character at a time, which can be useful in situations where you need to build a string character-by-character.
Australia
UK
UAE
Singapore
Canada
New
Zealand
Malaysia
USA
India
South
Africa
Ireland
Saudi
Arab
Qatar
Kuwait
Hongkong
Copyright 2016-2023 www.programmingshark.com - All Rights Reserved.
Disclaimer : Any type of help and guidance service given by us is just for reference purpose. We never ask any of our clients to submit our solution guide as it is, anywhere.