Get character from String

Complete source code below will show you, how to get character from a String in java.

*****************************************************************************
COMPLETE SOURCE CODE FOR : GetCharacterFromString.java
*****************************************************************************


public class GetCharacterFromString
{
public static void main(String[]args)
{
//Create a String that will be use to get character from it
String a="Hello!";

/**
*If you want to get character in a String,
*you can use charAt method from String class.
*Just put index of the character in it's argument.
*For your information index in String is start with
*0....so
*index 0 is for H
*index 1 is for e
*index 2 is for l
*index 3 is for l
*index 4 is for o
*index 5 is for !
**/

//Get first character in the String
char characterFirst=a.charAt(0);

//Print the first character that we get
System.out.println(characterFirst);
}
}


*****************************************************************************
JUST COMPILE AND EXECUTE IT
*****************************************************************************

RELAXING NATURE VIDEO