In this tutorial, we will go through the string pattern program in java. Before that, you may go through the following topic in java.
String Pattern:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | public class Main { public static void main(String args[]) { String str = "SIMPLE"; int length = str.length(); //length of the string for (int i = 0; i < length; i++) { for (int j = 0; j < length; j++) { System.out.print(str.charAt(j) + " "); } System.out.println(); } } } |
Output:
S I M P L E
S I M P L E
S I M P L E
S I M P L E
S I M P L E
S I M P L E