java get first element of string code example
Example 1: get first character of string java
var string = "freeCodecamp";
string.charAt(0); // Returns "f"
Example 2: java get first char
char fourth = "Banana".charAt(3);
var string = "freeCodecamp";
string.charAt(0); // Returns "f"
char fourth = "Banana".charAt(3);