
hello sir...how to get middle name using string tokenizer....??? eg..like name ANKIT it will select only K...!!!!

The given code accepts the name from the console and find the middle character from the name.
import java.util.*;
class GetMiddleCharacter
{
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
System.out.print("Enter Name: ");
String str=input.nextLine();
int len=str.length();
int c=len/2;
char ch[]=str.toCharArray();
System.out.println("Middle Character is: "+ch[c]);
}
}