startsWith substring first and last character java code example Example: java get first char char fourth = "Banana".charAt(3);