HomeНаука и техникаRelated VideosMore From: Telusko

9.6 How to use Wrapper classes in Java?

860 ratings | 76228 views
Wrapper classes are used to convert any data type into an object. The primitive data types are not objects; they do not belong to any class; they are defined in the language itself. Sometimes, it is required to convert data types into objects in Java language. Check out our website: http://www.telusko.com Follow Telusko on Twitter: https://twitter.com/navinreddy20 Follow on Facebook: Telusko : https://www.facebook.com/teluskolearnings Navin Reddy : https://www.facebook.com/navintelusko Follow Navin Reddy on Instagram: https://www.instagram.com/navinreddy20 Subscribe to our other channel: Navin Reddy : https://www.youtube.com/channel/UCxmkk8bMSOF-UBF43z-pdGQ?sub_confirmation=1 Telusko Hindi : https://www.youtube.com/channel/UCitzw4ROeTVGRRLnCPws-cw?sub_confirmation=1
Html code for embedding videos on your blog
Text Comments (110)
Sureshanand S (28 days ago)
Hi sir recentely i have faced issue when i compared Integer wrapper class variable like Integer A == Integer B . This comparison works well the A and B value is lesser than 127 . IFthe value is more than 127 it wont give proper result . Could you please explain what is behind with it . Also i changed that comparioson using intValue now . Just i have to curious to know about that issue . So please explain
Chaithanya Cm (3 months ago)
Can i use character,Boolean as wrapper classes? If yes, How?
Rajesh Arora (7 months ago)
Sir , which book to study for ICSE 10 java
Sruti Rai (8 months ago)
you clear my concepts dude everytime!
victini 2 (9 months ago)
Thank you lot☺
YUDI B (10 months ago)
thank you, sir, for teaching in a great way. I was always afraid of wrapper classes. Once in an interview, I was asked this question and i was like blank.. but now I know wrapper classes.
Sheroth kar (11 months ago)
Hi sir ! I need a code(program) which covers all most all the Important topic in Java.If u can do this means plzz upload a video. THANKs fr read my question Sir☺️☺️☺️
Lemon Tea (11 months ago)
I was stuck on this concept for a while, thank you
Zaid Alazwi (11 months ago)
Thanks Sir
nicolae marius (1 year ago)
Thanks Sir!
Raghu Nath (1 year ago)
Camera is bad
Syeda Atheeb (1 year ago)
U are unbelievable sir! 💓❤️
what is the need of using wrapper class in java??can you more specific ..please sir
manjusha sanaka (1 year ago)
You would have written one example for each wrapper class like float, double
sravani sai (1 year ago)
what is the need for making it completely object oriented?
Danut Baltag (1 year ago)
using wrapped classes makes your code thread-safe, because Integer class is an immutable type
mani teja (1 year ago)
What's wrong with your cam
Mohamed Moustafa (1 year ago)
this short video helped me a a lot, thanks for the effort <3
ismet öztürk (1 year ago)
good explanation
edu_ka (1 year ago)
Y we need primitve types ??? If we have a choise of wraper classs.........?????
Srividya Kundeti (1 year ago)
viewed many videos but finally understood this concept with your video thanks
Parshuram Rv (1 year ago)
super lovely explanation
Abu Talha (1 year ago)
really .... you explained much better then my computer teacher.. thanks..
D. Subramanyam 22 (1 year ago)
Advantages of wrapper classes?
Tanishq Saluja (1 year ago)
Simple,right?
whatcanisay3 (1 year ago)
thankyou, very well explained !
Rahul Srivastava (1 year ago)
Where to use wrapper classes ? whats its advantage , i mean I am asking about any use case , as wherever i want to use Integer i can use int.
Mohammed Viso (1 year ago)
Thank you
dontusehername (1 year ago)
thanks taklu
Frank Richardson (1 year ago)
You are an excellent Teacher!
Android Squad (1 year ago)
WHY INTEGER IS NEGATIVE I MEAN IN EG OF POPULATION OF COUNTRY HOW CAN POPULATION BE NEGATIVE!?
Arushi Mathur (2 years ago)
sir what we should call the functions, i.e. they are objects or they are primitive?
Sree Bhargava (2 years ago)
is there any difference b/w boxing and wrapping can we call wrapping as boxing and unwrapping as unboxing in java...
Praveen Ranjan (2 years ago)
no difference . they both generate the same byte code. yes you can call that.
Heitor Chavantes (2 years ago)
my prof in university records his lectures and posts them online. But he decides to turn mic off at important parts. hes helping you get thousands of subscribers. youre the man. keep doing what you do.
shizyninjarocks (2 years ago)
Very good explanation. But I don't understand why Wrapper classes are important or when you would need to use them.
laugh or dead (2 years ago)
in wrapping ur converting primitive variable to object but what is the use of it
Praveen Ranjan (2 years ago)
Java is an object-oriented language and can view everything as an object. The primitive data types are not objects; they do not belong to any class. eg: int i = 100; Integer i1 = new Integer(i); // conversion into object. this Object can be used in programming wherever ' i1 ' is required as an object.
Kalpesh Chandora (2 years ago)
Your teaching is good and straightforward. I really liked it.
Jitu Myself (2 years ago)
sir this video is not clear
Pavan Kumar (2 years ago)
Thanq
Pallab Sarkar (2 years ago)
thank you sir...nicely explained...
Mohammed Nabeel (2 years ago)
simple and clear explanation.learned many concepts from you sir..Thank you so much
maimed lord (2 years ago)
Thanks!
The Explorer (2 years ago)
Cant we workonly with primitive variables
The Explorer (2 years ago)
Sir but why we needed to convert premitive into wrapper class
laugh or dead (2 years ago)
primitive data types is only used for storing data or we just assingn value to them but in java there is some situations we have to use objects instead primitive data types it means when you want to use methods (ex:converting int to string)of wrapper classes which are predefined in java.lang package we have to create object for that wrapper classes in your current class and use them for different tasks ex:Integer ..etc
Hamza Zymawy (2 years ago)
Wonderful mashallah good videos
Michael Knox (2 years ago)
Thank you so much.
Dhruv Rajpurohit (2 years ago)
sir would you please recommend me which book to use for java , which is explaining all stuff well .....
Saim Selim (1 year ago)
use Dietel & Dietel and also Core Java Books
Randy Productions (2 years ago)
Thanks bro ! Great Teaching ! Keep it Up
HumanZero HumanZero (2 years ago)
+1 for toturial spelling
karthik golagani (3 years ago)
didn't get it.What is the difference between primitive and wrapper? In what ways they are different. why did wrapper classes exist?
Saim Selim (1 year ago)
this is especially useful when you're using array , because then the JVM can assign all the int to the Integer object , float in Float object and so on...
Rich Cohen (2 years ago)
But why is it advantageous. I means what's so great about converting them into objects which would take up more memories in stack? There has to be a catch. He mentioned for Collection Framework. I am still in core Java, so I really can't comprehend. Could you elaborate a bit more, please!!
Rohit Soni (2 years ago)
As java is a OOP language and everything in java works as an object of a class, We need to eliminate all the variables from our program And In order to do this we use Wrapper Classes. " Wrapper Class is used to convert all the primitive variables(int i, char abc, float f etc.) into object of a class. "
hamid siddiqui (3 years ago)
i learn lot from this tutorial i hv confusing abt wrapper classes , if we declaring variable with data type without wrapper classes plz explain
Rohit Soni (2 years ago)
Pls Elaborate your doubt regarding Wrapper Class, I could not find what is bothering you in this.
khmer tube (3 years ago)
can you show detail more
vikrant gupta (3 years ago)
where are they used? I mean practical advantage?
Telusko (3 years ago)
+vikrant gupta For Collection Framework
vidya moorthy (3 years ago)
Life saver. I have my exam in 2 days. Your tutorials are helping me a lot . Thank you so much :)
Hamza Zymawy (2 years ago)
how about your exam did you pass it ? am about to take my test on a few month any advises ?
drs succ (3 years ago)
awesome vid, you just saved my AP java grade
Sourav Bose (3 years ago)
Great... Simple way of understanding it!!
sunu praveena (3 years ago)
you are an awesome teacher...!!!!!!! thanks...!!!!
Rodney Greene (3 years ago)
Winning!
Sallylunn22 (3 years ago)
👍🏼👍🏼👍🏼
Adem Dinarević (3 years ago)
One of the better vids that I watched recently about programming. Great explanation! :)
shraddha sahu (3 years ago)
thank you sir
shraddha sahu (3 years ago)
thank you sir
Pratik Agarwal (3 years ago)
can we use the simple operators(+,-,*,/) on wrapper class objects .................?
Lovejeet Arora (7 months ago)
Can you explain it through the example...
Rohit Soni (2 years ago)
YES. You can apply arithmetic operation on them. :)
Jatin Lalwani (3 years ago)
Thank you!
smit dabre (3 years ago)
int a=Integer.parseInt(args[0]); in the above example we receive a value of type string object from the command line arguments so is the parse() used to convert the string object into primitive type????
sravanti reddy (3 years ago)
where we use this wraping usually?pls clarify. I can simply use as int i, why to convert it in to an Integer class
Sarika P.J (8 months ago)
These wrapper classes are immutable. So whenever you need immutable objects ie key of a hashmap, you can use this.
sravanti reddy (3 years ago)
+regis charles thankx regis.
regis charles (3 years ago)
+sravanti reddy you use integer object like when working with vector class where you have to pass an object instead of primitive datatype like int ,float etc
anand dubey (3 years ago)
too good :)
Mukarram Khan (3 years ago)
In real World, do we really need WRAPPER CLASS? If YES then why and how often ?
Siddhartha Pasumarthi (3 years ago)
Dude really cool !!
Ravi Teja (4 years ago)
sir  since wrapper class is also a class,then creating object for it,now at where should be variable value gets stored?? whether wrapper class also have any member variables for storing it??? thank youu//
Jay Bartgis (10 months ago)
It's stored in the one of the class's methods called intValue.
Anuj Birani (1 year ago)
in stack
Chris (4 years ago)
Thank you very much :)
Yash Dekate (4 years ago)
Thank you so much. :D
Devansh Agrawal (4 years ago)
Please upload more Video on Execption Handling please
zeyu Zhao (4 years ago)
Subscribed! Explained much better than my computer science teacher! Thx
Talha Ghaffar (4 years ago)
public class std {       int k=98;    public static void main(String args[]){        Integer iobj= new Integer(k);              System.out.println(iobj);     } } it not working (error)   . i tred it with same sytanx as  u wrote . . .
Talha Ghaffar (4 years ago)
ok thanx bro . . .
Bullibabu Kanugolu (4 years ago)
Try to put static before it.
Telusko (4 years ago)
+Talha Ghaffar  public static void main(String args[]) {     int k=98;     ........     ....... }
GD H (4 years ago)
100% 
G Raghunath Reddy (4 years ago)
why we create the obj using wrapper classes pls send ans to me pls sir
G Raghunath Reddy (4 years ago)
hi, mr.reddy i have a small dought about wrapper class in java ,i dont know when we use the wrapper class in real time and where it use 
chetan dhumal (4 years ago)
50% of my core concepts are clear bcz of you ...thank you. please upload Adv java -servlet and jsp 
chetan dhumal (3 years ago)
Thank you +Navin Reddy  i  really appreciate your help .  I proudly refer your youtube link to java aspirants ...
Telusko (3 years ago)
+chetan dhumal Link for Servlet and JSP  https://www.youtube.com/playlist?list=PLsyeobzWxl7oGCz4k9VyxhfmQpSU1dV9b
Pawan Kumar (4 years ago)
thxx..... Please make videos on these concepts Searching and Sorting Complexity Theory Linked Lists, Trees, Graphs Stacks, Queues Hash Tables Heaps
ROHAN CHAUBEY (4 years ago)
Subscribed! what is iobj ? is iobj name of the object ?
Pritesh gehlot (3 years ago)
Scanner sc=new Scanner(); compare sc with iobj its one and the same
ROHAN CHAUBEY (4 years ago)
+Navin Skills  Thank you! Your videos helped me a lot :)
Telusko (4 years ago)
yes Name of the object

Would you like to comment?

Join YouTube for a free account, or sign in if you are already a member.