Java - general

Array, initialize

On declaration:

String[] strs = {"Apfel", "Birne", "Pflaume");


On deklaration of multidimensional arrays:

String[][] strs = {{"Apfel", "Äpfel"}, {"Birne", "Birnen"}, {"Pflaume", "Plaumen"});




Inline in a methode call:

public void demo() {
   doSomething(new String[] {"Apfel", "Birne", "Pflaume"));
   ...
}
 
public void doSomething(String[] strs) {
   ...
}



Eigene Werkzeuge
Werkzeuge

gratis Counter by GOWEB
seit 9.10.2007