What are Wrapper classes in Java | Java Interview Questions #shorts #javaprogramming

preview_player
Показать описание
What is a Wrapper class?

A Wrapper class converts primitive data types into objects. When we create an object to a wrapper class, it contains a field and in this field, we can store primitive data types.
In other words, we can wrap a primitive value into a wrapper class object.

Why do we Need Wrapper Classes?

Wrapper classes convert primitive data types into objects. Objects are needed if we wish to modify the arguments passed into a method (because primitive types are passed by value).

Autoboxing: Automatic conversion of primitive types to the object of their corresponding wrapper classes is known as autoboxing. For example – conversion of int to Integer

Unboxing: It is just the reverse process of autoboxing. Automatically converting an object of a wrapper class to its corresponding primitive type is known as unboxing. For example – conversion of Integer to int

---------------------------------------------------------------------------------------------------------------------------

Top Core Java Interview Questions || Core Java Interview Questions and Answers
Java Interview Questions and Answers | Java Tutorial | Java Online Training
Top 10 Java Interview Questions | Java Interview Questions And Answers | Company Question |Viva|
Java Interview Questions And Answers | Public static void main | Java Programming Interview Questions And Answers
Java INTERVIEW Questions for Freshers | Java Memory management Interview question

#shorts #javashorts #java #javaprogramming #javainterviewquestions #javainterview #edureka #telusko
Рекомендации по теме