Overloading Method Matching : Boxing Unboxing « Utility Classes « SCJP

Home
SCJP
1.Java Source And Data Type
2.Operators
3.Modifiers
4.Type Casting
5.Statements
6.Object Oriented
7.Thread
8.Utility Classes
9.File
SCJP » Utility Classes » Boxing Unboxing 
8.10.5.Overloading Method Matching
public class MainClass{
  static void go(int x) { System.out.print("int ")}
  static void go(long x) { System.out.print("long ")}
  static void go(double x) { System.out.print("double ")}

  public static void main(String [] args) {
    byte b = 5;
    short s = 5;
    long l = 5;
    float f = 5.0f;

    go(b);
    go(s);
    go(l);
    go(f);
  }
}
int int long double
8.10.Boxing Unboxing
8.10.1.Rules for overloading methods using widening, boxing, and var-args
8.10.2.Boxing, ==, and equals()
8.10.3.Where Boxing Can Be Used
8.10.4.Wrapper reference variables can be null
8.10.5.Overloading Method Matching
8.10.6.Overloading with Boxing and Var-args
8.10.7.Predict the output of the following
8.10.8.boxing beat var-args
8.10.9.Overloading When Combining Widening and Boxing
8.10.10.A boxing operation followed by a widening operation in order to match an invocation to a method.
8.10.11.Overloading in Combination with Var-args
8.10.12.Autoboxing and auto-unboxing are compiler modifications that permit previously illegal combinations of wrappers and primitives.
8.10.13.The wrapper on the left-hand side must correspond exactly to the primitive type on the right-hand side.
8.10.14.The following autoboxing assignment is illegal
8.10.15.Boxing requires an exact match between the wrapper class and the primitive type.
8.10.16.Boxing also occurs when a method's return type is a wrapper.
8.10.17.Unboxing is the automatic extraction of a wrapped value.
8.10.18.Unboxing the parameter
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.