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.

Fehler beim Vector

Empfohlene Antworten

Veröffentlicht

Morgen Leutz

Ich will ein Vector füllen

und dann kommt diese Fehler Meldung

java.lang.ArrayIndexOutOfBoundsException: 1 > 0

Das füllen des Vectors passiert in einer Try{}catch(){} Ob das damit was zu tun hat

:confused:

empire

Dann poste doch mal den Code wo du deinen Vector füllst.

Aber mit dem try/catch Block hat das glaube ich nichts zu tun.

Sieht eher so aus als ob du eine Array-Grenze überschreitest.

Wenn Du in Deinem try-catch-Block keine ArrayIndexOutOfBoundsException abfängst, dann kann die natürlich immer noch auftreten.

Du wirst halt ein Objekt im Vector ansprechen, das es nicht gibt, und damit über die Grenzen der Collection gehen.

Vielleicht ist es aber auch gar nicht der Vektor. Mit was füllst Du denn den Vector?

k.o.b

Der Fehler tritt beim Vector auf.


a=1;

while (rs1.next())
{

vecName.add(a,rs1.getString("Spalte1"));

}
[/PHP]

Probiers doch mal mit a = 0;

Die Position 1 gibt es ja noch nicht.

javadoc: ArrayIndexOutOfBoundsException - index is out of range (index < 0 || index > size()).

Kann aber sein, das das nicht funktioniert.

Oder Du lässt das mit dem Index und gibst nur vector.add(object) an, dann hängt er das Objekt ans Ende.

k.o.b

o ich habs,, Thanks....

empire

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.