FileDocCategorySizeDatePackage
Maps1.javaAPI DocExample1011Sat Sep 12 03:01:00 BST 1998None

Maps1

public class Maps1 extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

    HashMap map = new HashMap();
    Object value;

    value = map.add( "Dog", "Marble" );
    System.out.println( "value from add = " + value );

    value = map.add( "Cat", "Beauty" );
    System.out.println( "value from add = " + value );
    System.out.println( "map = " + map );

    value = map.add( "Cat", "Agatha" );
    System.out.println( "value from add = " + value );
    System.out.println( "map = " + map );

    value = map.get( "Cat" );
    System.out.println( "Cat name is " + value );

    value = map.get( "Ape" );
    System.out.println( "Ape name is " + value );

    value = map.put( "Cat", "Agatha" );
    System.out.println( "value from put = " + value );
    System.out.println( "map = " + map );

    String name3 = (String)map.get( "Cat" );
    System.out.println( "Cat name is " + name3 );