Java Program example to demonstrate String charAt method
Program
import java.util.Scanner;
public class StringCharAt
{
public static void main(String args[])
{
String str = "Welcome to oodlescoop";
int pos;
Scanner sc = new Scanner(System.in);
System.out.println("Enter an integer number:");
pos = sc.nextInt();
System.out.println("Character at pos " + pos + " is: " + str.charAt(pos));
}
}
Output
Enter an integer number:
11
Character at pos 11 is: o