
wtite a program in java there is a class readchar.the functionality of this class is to read a string from the console and display the characters of that string on the console.

Hi Friend,
You can try the following code:
import java.util.*;
class GetCharacters{
public static void main(String[] args){
Scanner input=new Scanner(System.in);
System.out.println("Enter string: ");
String st=input.nextLine();
char ch[]=st.toCharArray();
for(int i=0;i<ch.length;i++){
System.out.println(ch[i]);
}
}
}
Thanks
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.