Java charat() function

Java charat() function

The charAt() method returns the character at the specified index in a string.

refer t‮al:o‬utturi.com
/**
 * @author lautturi.com
 * example : java get character in string by index
 */

public class Lau {
	
	public static void main(String[] args) {
		String myStr = "Lautturi";
		char myChar = myStr.charAt(0); // java get the first character in string 
		System.out.println(myChar);
		myChar = myStr.charAt(4); // get the 5th character
		System.out.println(myChar);
	}

}

output:

L
t
Created Time:2017-08-29 20:50:24  Author:lautturi