public class Exercise2 {
public static void main(String[] args) {
String str = "atnyla.com";
System.out.println("Original String : " + str);
// codepoint at index 1
int val1 = str.codePointAt(1);
// codepoint at index 9
int val2 = str.codePointAt(9);
// prints character at index1 in string
System.out.println("Character(unicode point) = " + val1);
// prints character at index9 in string
System.out.println("Character(unicode point) = " + val2);
}
}
Original String : atnyla.com
Character(unicode point) = 116
Character(unicode point) = 109
Press any key to continue . . .
First understand the algorithm carefully. Then study the program line-by-line and compare it with the output. Finally, review the explanation section to strengthen your logic and programming understanding.
Rewrite the program without looking at the code. Modify values, conditions or logic and run it again. This helps improve confidence and strengthens coding skills much faster.