Online Java Compiler By
JavaTpoint.com
public class CharactercodePointCountMethodExample6 { public static void main(String[] args) { // Initialize a new CharSequence object CharSequence cs1 = "This is a unique example!"; System.out.println(cs1); // Initialize beginIndex and endIndex int beginIndex1 = 0; int endIndex1 = cs1.length(); int result1 = Character.codePointCount(cs1, beginIndex1,endIndex1); System.out.println("The result comes to be: "+result1); CharSequence cs2 = "Java is a high level language!"; System.out.println(cs2); int beginIndex2 = 0; int endIndex2 = cs2.length(); int result2 = Character.codePointCount(cs2, beginIndex2,endIndex2); System.out.println("The result comes to be: "+result2); CharSequence cs3 = "Java is based on the cocepts of OOPS!"; System.out.println(cs3); int beginIndex3 = 0; int endIndex3 = cs3.length(); int result3 = Character.codePointCount(cs3, beginIndex3,endIndex3); System.out.println("The result comes to be: "+result3); } }
Output