25.02.2017 Views

java_tutorial

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Java<br />

}<br />

}<br />

}<br />

System.out.println();<br />

// Deposit 1000 into Zara's account<br />

double balance = ((Double)ihm.get("Zara")).doubleValue();<br />

ihm.put("Zara", new Double(balance + 1000));<br />

System.out.println("Zara's new balance: " +<br />

ihm.get("Zara"));<br />

This will produce the following result:<br />

Ayan: 1378.0<br />

Zara: 3434.34<br />

Qadir: -19.08<br />

ahnaz: 123.22<br />

Daisy: 99.22<br />

Zara's new balance: 4434.34<br />

The following legacy classes defined by <strong>java</strong>.util have been discussed in the previous<br />

chapter:<br />

Sr.<br />

No.<br />

Classes with Description<br />

1<br />

Vector<br />

This implements a dynamic array. It is similar to ArrayList, but with some<br />

differences.<br />

2<br />

Stack<br />

Stack is a subclass of Vector that implements a standard last-in, first-out stack.<br />

Dictionary<br />

3<br />

Dictionary is an abstract class that represents a key/value storage repository<br />

and operates much like Map.<br />

421

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!