Unterschiede
Hier werden die Unterschiede zwischen der gewählten und der aktuellen Version gezeigt.
java:array-initialize 2008/09/18 10:40 | java:array-initialize 2020/01/22 20:59 aktuell | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
+ | [[java|Java - Allgemein]]\\ | ||
====== Array, initialisieren ====== | ====== Array, initialisieren ====== | ||
Bei der Deklaration:\\ | Bei der Deklaration:\\ | ||
<code java> | <code java> | ||
- | String[] strs = new String[] = {"Apfel", "Birne", "Pflaume"); | + | String[] strs = {"Apfel", "Birne", "Pflaume"); |
</code>\\ | </code>\\ | ||
+ | Bei der Deklaration eines mehrdimensionalen Arrays:\\ | ||
+ | <code java> | ||
+ | String[][] strs = {{"Apfel", "Äpfel"}, {"Birne", "Birnen"}, {"Pflaume", "Plaumen"}); | ||
+ | </code> | ||
+ | \\ | ||
+ | <html> | ||
+ | <script type="text/javascript"><!-- | ||
+ | google_ad_client="pub-9681858985507948"; | ||
+ | google_ad_width = 468; | ||
+ | google_ad_height = 60; | ||
+ | google_ad_format = "468x60_as"; | ||
+ | google_ad_type = "text"; | ||
+ | google_ad_channel = ""; | ||
+ | google_color_border = "cccccc"; | ||
+ | google_color_bg = "FFFFFF"; | ||
+ | google_color_link = "1d2d8c"; | ||
+ | google_color_text = "000000"; | ||
+ | google_color_url = "1d2d8c"; | ||
+ | //--> | ||
+ | </script> | ||
+ | <script type="text/javascript" | ||
+ | src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> | ||
+ | </script> | ||
+ | </html> | ||
+ | \\ | ||
+ | \\ | ||
Inline in einem Methodenaufruf:\\ | Inline in einem Methodenaufruf:\\ | ||
<code java> | <code java> | ||
- | public void doSomething(String[] strs) { | + | public void demo() { |
+ | doSomething(new String[] {"Apfel", "Birne", "Pflaume")); | ||
... | ... | ||
} | } | ||
- | public void demo() { | + | public void doSomething(String[] strs) { |
- | doSomething(new String[] {"Apfel", "Birne", "Pflaume")); | + | |
... | ... | ||
} | } | ||
</code>\\ | </code>\\ | ||