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.

Hashtable

Empfohlene Antworten

Veröffentlicht

// Kann mir einer bitte sagen, warum er meine Hashtable nicht füllt. Er sollte sie doch bei jedem Durchlauf füllen. Er schreibt nur den letzten Key, Value in die Hashtable.

public void auswahlProperty()

{

try

{

propOutFile = new FileOutputStream(filenameauswahl);

auswahlout = new Properties();

auswahlout.setProperty("Default-Einstellungen","Pfad");

auswahlout.setProperty("User-Einstellungen","Pfad");

auswahlout.setProperty("Handbuch","Pfad");

auswahlout.setProperty("Modus","Pfad");

auswahlout.setProperty("Ergenbnistyp","Pfad");

auswahlout.setProperty("SGML","Pfad");

auswahlout.setProperty("Dokumentation","Pfad");

auswahlout.setProperty("Protokoll","Pfad");

auswahlout.store(propOutFile, " Auswahl - Einstellungen ");

propOutFile.close();

propInFile = new FileInputStream(filenameauswahl);

auswahlin = new Properties();

auswahlin.load(propInFile);

propInFile.close();

propNames = auswahlin.propertyNames();

while (propNames.hasMoreElements())

{

String key = (String) propNames.nextElement();

String value = auswahlin.getProperty (key);

hashtable = new Hashtable();

hashtable.put(key,value);

enum = hashtable.keys();

System.out.println("Key: " + key + "=" + "Value: " + value);

}

while (enum.hasMoreElements())

{

String key = (String)enum.nextElement();

System.out.println(key + "=" + hashtable.get(key));

}

}

catch (FileNotFoundException fnfe)

{

System.err.println(fnfe.getMessage());

}

catch (IOException ioe)

{

System.err.println(ioe.getMessage());

}

}

meiner Ansicht nach liegt es daran, dass Du die HashTable innerhalb der Schleife immer wieder neu erzeugst (new HashTable). Dann überschreibst Du natürlich immer die alten Einträge.

Wenn Du sie vor der Schleife initialisierst, sollte es gehen.

k.o.b

Danke,

jetzt wo du es sagst. Ist ja eigentlich logisch, das ich die Hashtable außerhalb erzeugen muss und nicht immer wieder eine neue, wenn sie in der Schleife liegt.

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.