W

     
widening conversion

What happens when a value of one type is converted to a wider type ”that is, a type with a wider range of possible values. Converting from a short to an int is a widening conversion; converting from a char to a byte is not. The Java runtime knows that your variable couldn't suffer any loss of data by putting its value in a container bigger than the one it already has. For this reason, widening conversions happen automatically. You can lose data when performing a widening conversion that is done automatically. Numerical range is the important thing. Example ( float 's numerical range encompasses long 's, but long (64-bits) can hold more digits than float (32-bits)):

 

 public class ConversionTest { public static void main(String[] args) {      float a;      long b = 4203020102023324L;      a = b;      System.out.println("float: " + a);      System.out.println("long: " + b);      }} 

 

Output:
 

 float: 4.2030201E15 long: 4203020102023324 



wildcard

Used in regular expressions to mean any character. In generics, the wildcard is represented as ? . This is used in a generic method declaration to indicate an unknown type. The wildcard can be type-bounded by either upper or lower limits.

See also [bounds]


wrapper class

The primitive wrapper classes in the java.lang package correspond to each of the eight primitive variable types: the Boolean primitive wrapper class is java.lang.Boolean; the char wrapper class is Character , and so forth. The purpose of the primitive wrappers is to provide utility methods (such as Double.parseDouble() ), constants (such as Boolean.TRUE and Float.POSITIVE_INFINITY ), and object encapsulation for primitives.





Java Garage
Java Garage
ISBN: 0321246233
EAN: 2147483647
Year: 2006
Pages: 228
Authors: Eben Hewitt

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net