Auto-unboxing allows you to mix different types of numeric objects in an expression. : Autobox Unbox « Data Type « Java






Auto-unboxing allows you to mix different types of numeric objects in an expression.

  
class AutoBox4 {
  public static void main(String args[]) {

    Integer iOb = 100;
    Double dOb = 98.6;

    dOb = dOb + iOb;
    System.out.println("dOb after expression: " + dOb);
  }
}

   
  








Related examples in the same category

1.What is Autoboxing?
2.Type conversion (JDK1.5 Autoboxing/Unboxing)
3.Demonstrate autobox and unbox.Demonstrate autobox and unbox.
4.Autobox unbox takes place with method parameters and return values.Autobox unbox takes place with method parameters and return values.
5.Autobox unbox occurs inside expressions. Autobox unbox occurs inside expressions.
6.Autobox unbox: convertAutobox unbox: convert
7.Autobox unbox a Boolean and Character. Autobox unbox a Boolean and Character.
8.An error produced by manual unboxing. An error produced by manual unboxing.
9.Java Autobox and UnboxJava Autobox and Unbox
10.Autobox DemoAutobox Demo
11.Autoboxing/unboxing takes place with method parameters and return values.
12.Autoboxing/unboxing occurs inside expressions.