Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Newbie Frage

Empfohlene Antworten

Veröffentlicht

Also ich hab hier folgendes abgewandeltes Listing aus nem JavaBuch, mit dem ich bissl experementieren wollte.

public class lol2

{

public static void main(String[] args)

{

int z = 3;

int[][] a = { {1,3,4,6},

{1,2,3},

{3,4,5},

{6,7,8,9}

};

for (int i=0; i < a.length; ++i) { //geht arry durch bis zum ende

z = a.length; // länge der 2. dimension ??? sagt man das so?

if (z >= 3) { //gucken ob in der 2. dim 4 Elemente da sind

System.out.println(a[3]); // 4. Element ausgeben

}

}

}

}

Warum funzt das nicht?

Irgendwie funktioniert die If bedingung nicht 8[

Originally posted by DerFahnder

if (z >= 3) {

das muss z>3 heissen, da z>=3 bei allen unter Arrays erfüllt ist und du dann versuchst bei den Arrays mit drei Elementen das Vierte auszulesen.

Gruß Jaraz

PS: Java Klassennamen bitte immer mit nem großen Buchstaben beginnen. ;)

Hab das Problem selbst gelöst.

Length fängt halt bei 1 an zu zählen. Bei einer Länge von 3 ist aber nicht garantiert, daß es a[3] gibt, da es schon das 4. Element ist.

Browser aktualisieren ownz...

Full Ack an Jaraz

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.