View RSS Feed

My Java Tips

  1. Autoboxing And Unboxing in Java 5

    by , 11-08-2011 at 07:01 PM (My Java Tips)
    Java 5 supports automatic conversion of primitive types (int, float, double etc.) to their object equivalents (Integer, Float, Double,...) in assignments, method and constructor invocations. This conversion is know as autoboxing.

    Java 5 also supports automatic unboxing, where wrapper types are automatically converted into their primitive equivalents if needed for assignments or method or constructor invocations.For example:

    Java Code:
    	int inative = 0;
    Java SE