Learnerslesson
   JAVA   
  SPRING  
  SPRINGBOOT  
 HIBERNATE 
  HADOOP  
   HIVE   
   ALGORITHMS   
   PYTHON   
   GO   
   KOTLIN   
   C#   
   RUBY   
   C++   




String - charAt() Method


char charAt(int index)


charAt(..) method is used to return us the character of a String if we supply it with index value.


Say, if we want to know which character is present at 4th index of the String "Hello".


Example :



public class Test{
	public static void main(String[] arg){
		String firstString = "Hello"; 
		char pos = firstString.charAt(3);	   
		
		System.out.println("The character is : "+pos);
	}
}


Output :



  The character is : o

Note : Index starts counting from 0.