Ich verwende dazu meistens Vector.
@Tarjan: Was ist der Vorteil von ArrayList?
Code:
import java.util.Vector;
class xyz{
public static void main(String[] args) throws IOException {
BufferedReader sysin = new BufferedReader (new InputStreamReader(System.in));
Vector texte=new Vector(20);
for (int v = 0 ; v < 20 ; v++){
System.out.println("bitte namen eingeben;");
String name = (sysin.readLine());
texte.add(name);
//oder: texte.set(i,name);
System.out.println(texte.get(i));
}
}
}
Btw.: Recht brauchbare Java Bücher für Anfänger:
Java ist auch eine Insel, unter:
http://www.galileocomputing.de/openbook/javainsel4/
Hanspeter Mössenböck, Sprechen sie Java, dpunkt.verlag, 2001, ISBN 3-89864-117-1
Und die Quelle: JavaDoc unter
http://java.sun.com/j2se/1.5.0/docs/api/
Jak
____________________________________
Join the DNRC |
Godwin\'s Law (thx@stona)
Documentation is like sex: If it\'s good, it\'s very, very good. If it\'s bad, it\'s better than nothing.
\"In theory, theory and practice are the same. In practice, they are not\" (Lawrence Berra)