To get first character of a string in Java, call the
charAt method with 0.Here's how you do it:
String string = "Hello World!";
char firstCharacter = string.charAt(0);
System.out.println(firstCharacter); // H

charAt method with 0.Here's how you do it:
String string = "Hello World!";
char firstCharacter = string.charAt(0);
System.out.println(firstCharacter); // H