Start Search Contents Index Links About
NoBoxing.java
/**
 * Remember Java
 * Web: rememberjava.com
 
 @author Havard Rast Blok
 */

import java.util.*;

/**
 
 * Example of old style wrapping and unwrapping of primitive types.
 *
 *
 */
public class NoBoxing {
  public static void main(String args[]) {
    Vector v = new Vector();
    
    //add integers in Integer class wrappers
    v.add(new Integer(111));
    v.add(new Integer(222));
    v.add(new Integer(333));

    for (int i = 0; i < v.size(); i++) {
      //unwrap, cast and get int value
      int tmp = ((Integerv.get(i)).intValue();
      System.out.println(tmp);
    }

  }
}


site: Håvard Rast Blok
mail:
updated: 27 July 2007