Hey, This is a small java program for sorting user input into a vector it, sorts and outputs. Im a newbie but it works although it flash a warning
program.java uses unsafe or unchecked operations.
recompile with -XLint: unchecked for details.
Its not the end of the world but this is homework so i can see me getting slated for it.
Code:
import java.util.Vector;
import java.util.Collections;
import javax.swing.JOptionPane;
public class VectorSort {
public static void main(String[] args) {
Vector v = new Vector();
String userInput;
for (int i= 0; i<= 5; i++)
{
userInput = JOptionPane.showInputDialog(null, "Enter words to be sorted now:");
v.add(userInput);
}
Collections.sort(v);
JOptionPane.showMessageDialog(null, "Vector elements after sorting : ");
for(int j=0; j<v.size(); j++)
JOptionPane.showMessageDialog(null, v.get(j));
}
}