i use Array.sort() in swing and awt please help me with my code
here is my listener code i did not post my entire code because its very long and i believe that my only problem is in this line of code
sortbtn.addActionListener(new ActionListener()
{
publicvoid actionPerformed(ActionEvent e)
{
BufferedReader reader =new BufferedReader (new InputStreamReader(System.in));
try
{
int x, y;
String name[] =new String[3];
for(x = 0; x < 3; x++)
{
name[x]=JOptionPane.showInputDialog(null,"Enter a String");
name[x]=reader.readLine()
}
Arrays.sort(name);
for(y = 0; y < 3; y++)
{
txtsort2.append(name[y]);
}
}
catch(Exception ex)
{
JOptionPane.showMessageDialog(null,"Invalid");
}
}
});
i should enter a string 3 times then it will sort the strings and print the sorted strings in txtsort2 but instead of doing that the program stuck up please help me what's wrong with my code thank's

