filmov
tv
What is Autoboxing and Unboxing in Java? - 045
Показать описание
Let's start with the number classes, and then we'll talk about how Java uses autoboxing and unboxing to convert these classes to and from Java primitives.
In earlier videos we looked at the primitive data types for numbers. They were the bytes, shorts, ints, longs, floats, and doubles.
Java converts between numbers and primitives automatically using something called autoboxing and unboxing.
Autoboxing is when Java automatically converts a number primitive to an instance of the corresponding number class. The simplest example of this is when you declare a number class instance.
Unboxing happens in the other direction. This is when we have the number class, but Java is expecting the primitive. In this case, Java "unboxes" the primitive from the wrapper class.
#java #programming #tutorial
▼
▼
Concepts: Java autoboxing and unboxing, Java Number classes, Java converting types
Social Links: Don't hesitate to contact me if you have any further questions.
Related Videos:
Media credits: All images are owned by DJ Spiess unless listed below
Music
In earlier videos we looked at the primitive data types for numbers. They were the bytes, shorts, ints, longs, floats, and doubles.
Java converts between numbers and primitives automatically using something called autoboxing and unboxing.
Autoboxing is when Java automatically converts a number primitive to an instance of the corresponding number class. The simplest example of this is when you declare a number class instance.
Unboxing happens in the other direction. This is when we have the number class, but Java is expecting the primitive. In this case, Java "unboxes" the primitive from the wrapper class.
#java #programming #tutorial
▼
▼
Concepts: Java autoboxing and unboxing, Java Number classes, Java converting types
Social Links: Don't hesitate to contact me if you have any further questions.
Related Videos:
Media credits: All images are owned by DJ Spiess unless listed below
Music
Комментарии