import javax.swing.*;

public class StringStartEnd
{
 public static void main(String args[])
  {
    String strings[] =
     {"started", "starting", "ended", "ending"};
    String output = "";

    for (int count = 0; count<strings.length; count++)

       if (strings[count].startsWith("st"))
        output += "\"" + strings[count] +
          "\" starts with \"st\"n";

     output += "\n";

     for (int count = 0; count < strings.length; count++)
       if (strings[count].startsWith("art",2))
         output += "\"" + strings [count] +
         "\" starts with \"art\" at position 2\n";

     output += "\n";

     for (int count = 0; count < strings.length; count++)

      if(strings[count].endsWith("ed"))
        output += "\"" + strings[count] +
        "\" ends with \"ed\"\n";

      JOptionPane.showMessageDialog(null, output,
      "Demonstrating String Class Comparisons",
      JOptionPane.INFORMATION_MESSAGE);

      System.exit(0);
    }
 }