import java.io.*;
import java.util.*;
class Desiredcharacter
{
public static void main (String[ ]args)
{
Scanner sc= new Scanner(System.in);
String name= sc.nextLine();
System.out.println ("Enter your name");
System.out.println("The desired letter of your name is:"+" "+name.charAt (0));
}
}
Explanation:- This program is to print desired character of your name by giving an integer in parenthesis at name.charAt() the desired letter of your name is printed and that is the output of the program
For example I've given Abdulkalam as name and name.charAt (4) in program then the 5th letter of the name that is letter (l) is printed
No comments:
Post a Comment