import javax.swing.JOptionPane;
class sort{
public static void main(String Bassam[])
{
String First=" ",Second=" ",Third,Fourth,Fifth,Output=" ";
First=JOptionPane.showInputDialog("Enter First Name:");
Second=JOptionPane.showInputDialog("Enter Second Name:");
Third=JOptionPane.showInputDialog("Enter Third Name:");
Fourth=JOptionPane.showInputDialog("Enter Fourth Name:");
Fifth=JOptionPane.showInputDialog("Enter Fifth Name:");
Output=First+"\n"+Second+"\n"+Third+"\n"+Fourth+"\n"+Fifth+
"\n********************\nThe Sorted \n********************\n";
String Arr[]={First,Second,Third,Fourth,Fifth};
{
for(int i=0;i<5;i++)
for(int j=0;j<5-i-1;j++)
if ( Arr[j].compareTo(Arr[j+1])>0)
{
String Temp=Arr[j];
Arr[j]=Arr[j+1];
Arr[j+1]=Temp;
}
}
for(int o=0;o<5;o++)
Output+=Arr[o]+"\n";
JOptionPane.showMessageDialog(null,Output,"Sort Name",JOptionPane.PLAIN_MESSAGE );
System.exit(0);
}
}