Print all Character of String line by line.
Print all Character of String line by line.
Description:-
This program takes an String and we need to print each letter or character of that string on each line.
Code:-
import java.lang.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String str = sc.next();
int len = str.length();
char allLetters[] = str.toCharArray();
for(int i=0;i<len;i++)
System.out.println(allLetters[i]);
}
}
Feedback:-
After reading this page if you have any feedback do let me know in comments; i will try to bring those things in my upcoming posts.
Comments
Post a Comment