Hi
This is my source code at the moment:
public class Reihung <Schluessel, E extends Beschluesselt<Schluessel>>{
protected E [] sammlung;
public int suchen (Schluessel suchSchluessel) {
for (int i = 0; i < sammlung.length; i++) {
if (sammlung[i] != null && sammlung[i].getSchluessel() == suchSchluessel)
return i;
}
return -1;
}
public static void main(
String[] args) {
//TODO: Sammlung anlegen
}
}
I want to create a collection (sammlung = collection). Thus, the main method is static, but the field sammlung is not static. I need to instantiate an object within the main method. How can I do it?
Regards, Urs