Wrapper Class in Java | With Example

Pubblicato il: 22 aprile 2023
sul canale di: Techie coding
208
23

A Wrapper class in Java is a class whose object wraps or contains primitive data types. 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 it is needed?

There are certain needs for using the Wrapper class in Java as mentioned below:

They 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).

The classes in java.util package handles only objects and hence wrapper classes help in this case also.

Data structures in the Collection framework, such as ArrayList and Vector, store only objects (reference types) and not primitive types.

====================================

Thank you for Watching :

Happy coding Keep Learning 😊

====================================

subscribe for more videos :

   / @techie_coding  

   / @techie_coding  

   / @techie_coding  

====================================

#javaprogramming #wrapperclassinjava
#javatutorialforbeginners #java #corejava
#eclispe #javabasics #javatutorial


In questa pagina del sito puoi guardare il video online Wrapper Class in Java | With Example della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Techie coding 22 aprile 2023, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 208 volte e gli è piaciuto 23 spettatori. Buona visione!