Question
program to print characters in given word
Share code with your friends
Share on whatsapp
Share on facebook
Share on twitter
Share on telegram
Code
import java.util.Scanner;
public class characterInWord
{
public static void main(String[] args)
{
String wd="";
char ch=' ';
int i=0,len=0;
Scanner sc = new Scanner(System.in);
System.out.println("Enter a word");
wd = sc.next();
System.out.println("given word:"+wd);
System.out.println("characters in word:");
len=wd.length();
for(i=0;i< len;i++)
{
ch=wd.charAt(i);
System.out.println(ch);
}
}
}