write a program to find the first letter of your name by using charAt()
Answers
Answered by
7
Explanation:
If you want the first letter from a given String then just call the charAt(0) because the first character stays at the zeroth position in String. For example, if given String is "Avenger" then charAt(0) will return letter "A", the first letter as shown below:
char first = "Avengers".charAt(0);
System.out.println(first)
Output
A
Similar questions