Latest web development tutorials

Java charAt () method

Java String class Java String class


charAt () method returns the character at the specified index. The index ranges from 0 to length () - 1.

grammar

public char charAt(int index)

parameter

  • index - theindex characters.

return value

Returns the character at the specified index.

Examples

public class Test {

	public static void main(String args[]) {
		String s = "www.w3big.com";
		char result = s.charAt(8);
		System.out.println(result);
	}
}

The above program execution results:

o

Java String class Java String class