import java.text.DecimalFormat;
import java.text.Format;
import java.text.NumberFormat;
import javax.swing.JOptionPane;
/*
 * WrapperExample.java
 *
 * Created on January 6, 2005, 6:20 PM
 */

/**
 *
 * @author Bill Kraynek
 */
public class WrapperExample {
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Integer x = 3737;
        Double y = .733737;
        // Here x and y are unboxed (converted to int and double),
        // multiplied and then the result is boxed (converted to class Double)
        Double z = x*y;
        // Assigning a Double to an Integer is illegal
        // Casting a Double to an int or an Integer is illegal
        // The Double can be returned as a double and then cast to an int
        Integer w = (int)z.doubleValue();
        // Use standard format
        Format fmt = NumberFormat.getInstance();        
        JOptionPane.showMessageDialog(null,"x = " + fmt.format(x) + "\n y =  " +fmt.format(y)
                                        + "\n z =  " + fmt.format(z) + "\n w = " + fmt.format(w));
    } // end main
    
}

