Java String Pattern: 1

string pattern 1

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:

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