In this course, we will learn about wrapper classes, auto-boxing, and unboxing concepts.
- What is Wrapper Class?
- Conversion of Types
- Autoboxing - Unboxing
- Anyone looking to get Oracle Java Certification
- Those who want to learn the Java Programming language from scratch
- Java developers who want to increase their knowledge
- Beginners with no previous coding experience in Java programming
- Those who want to learn tips and tricks in Oracle Certified Associate – Java SE 8 Programmer certification exams
- No prior knowledge is required about the Java programming language
- Basic computer knowledge
Hi there. In the previous lesson, we learned what wrapper class is. In this video, we will talk about the type conversion between primitive and wrappers. If you're ready, let's start. We have two types of conversion. The first one is from the primitive type to the wrapper class, and the second one is from the wrapper class to the primitive type. In the first type, we use two ways to convert from a primitive type into an object of the corresponding wrapper class. The first way is using the constructor of the wrapper classes. As you see in the example, we use the constructor of the integer wrapper class to convert the int primitive type to the integer wrapper class. The second way is using the static method of the wrapper class.
As you see in the example, we use the value of static method of the integer class to convert the int primitive type to the integer wrapper class. The value of method returns an instance representing the specified int value. Okay, these are the converting from primitive to wrapper. Now, let's look at converting the wrapper to primitive. In the second type, we use a way to convert the converting wrapper class into a primitive type. We can use the corresponding methods to get the primitive type. For example; int value parenthesis, double value parentheses, short value parentheses, methods, etc. But with Java 5, this conversion is done automatically by using auto boxing and unboxing concepts. Let's see these concepts in the next video. See you in the next video
OAK Academy is made up of tech experts who have been in the sector for years and years and are deeply rooted in the tech world. They specialize in critical areas like cybersecurity, coding, IT, game development, app monetization, and mobile development.