16a


package jbPack;

import javax.swing.*;
import java.util.*;
import java.io.*;

public
class Program {

public static void main(String[] args)
{
new Program(args);
}

public Program(String[] args)
{
String text = "";
ArrayList list=new ArrayList();
int s = 0;
int loc = 0;
do {
text = JOptionPane.showInputDialog("Podaj tekst:");
if (text != null) {
loc = sort(list, text);
list.add((loc), text);
}
System.out.println(list);
}while(text != null);
JOptionPane.showMessageDialog(null,list);
System.exit(0);
}


public int sort(ArrayList list, String text)
{
int i = 0;
for(i = 0; i < list.size(); i++)
if (((String)list.get(i)).compareTo(text) >= 0)
break;
return i;
}
}


Wyszukiwarka

Podobne podstrony:
16a
16a
rs 16a 7gvce6q6qml7lpaea4w3t3sfre66uwab6ku2xxq
16a KNX LonWorks Comparison Ozadowicz
rz 16a nomk5hzbg4eoybfdszx2t4gbwr5jztprbn2c6xy
16a
16a
16a
Zadanie nr 1 do PIT 16A
16a
16a
16a
DII 500V gR 16A
16a

więcej podobnych podstron