A narrowing conversion is a conversion from a larger numeric type to a smaller numeric type. : Type Casting « Type Casting « 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 » Type Casting » Type Casting 
4.1.4.A narrowing conversion is a conversion from a larger numeric type to a smaller numeric type.
//Narrowing conversions require the cast operator.
//Casting enables numeric conversions that would not be allowed by the compiler. 
public class MainClass{
    public static void main(String[] argv){
        long l = 100000000L;
        short s = (short)l;
        System.out.println();
    }
}
4.1.Type Casting
4.1.1.You can explicitly change the type of a value by casting.
4.1.2.Change the object instance type
4.1.3.A widening conversion is a conversion from a smaller numeric type to a larger numeric type.
4.1.4.A narrowing conversion is a conversion from a larger numeric type to a smaller numeric type.
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.