Autoboxing and Unboxing

Autoboxing is the automatic conversion that the Java compiler makes between the primitive types and their corresponding object wrapper classes. For example, converting an int to an Integer, a double to a Double, and so on. If the conversion goes the other way, this is called unboxing.

Java Official Tutorials

Integer object wrapper class example:

example

example

example

Boxing and unboxing example: 1

2

3

1

1

results matching ""

    No results matching ""