Serialization Deserialization & Externalization | Java Interview Questions and Answer | Code Decode

  Рет қаралды 59,028

Code Decode

Жыл бұрын

In this video of code decode core java we have covered serialization, deserialization and externalization
Udemy Course of Code Decode on Microservice k8s AWS CICD link:
openinapp.co/udemycourse
Course Description Video :
yt.openinapp.co/dmjvd
What is Serialization
Serialization is the conversion of a Java object into a static stream (sequence) of bytes, which we can then save to a database or transfer over a network.
Classes that are eligible for serialization need to implement a special marker interface, Serializable. The JVM allows special privileges to the class which implements the Serializable Interface.
Byte stream is platform-independent. This means that once you have a stream of bytes you can convert it into an object and run it on any kind of environment.
A class to be serialized successfully, two conditions must be met −
The class must implement the java.io.Serializable interface.
All of the fields in the class must be serializable. If a field is not serializable, it must be marked transient.
static fields belong to a class (as opposed to an object) and are not serialized
What is Deserialization
Deserialization is precisely the opposite of serialization. With deserialization, you start with a byte stream and re-create the object you previously serialized in its original state. However, you must have the definition of the object to successfully re-create it.
FileInputStream fileIn = new FileInputStream("/tmp/employee.ser");
ObjectInputStream in = new ObjectInputStream(fileIn);
e = (Employee) in.readObject();
in.close();
fileIn.close();
What is Externalization?
Externalization in Java is used whenever you need to customize the serialization mechanism.
In serialization, the Java Virtual Machine is totally responsible for the process of writing and reading objects. This is useful in most cases, as the programmers do not have to care about the underlying details of the serialization process. However, the default serialization does not protect sensitive information such as passwords and credentials, or what if the programmers want to secure some information during the serialization process?
Thus externalization comes to give the programmers full control in reading and writing objects during serialization. JVM has no control over it. The complete serialization control goes to the application.
Based on our requirements, we can serialize either the whole data field or a piece of the data field using the externalizable interface which can help to improve the performance of the application.
Externalizable interface internaly extends Serializable interface
Externalizable interface is not a marker interface like Serializable interface. So, it provides two methods that are as follows:
void readExternal(ObjectInput inStream) - we call readExternal() method when we want to read an object’s fields from a stream. We need to write logic to read an object’s fields inside the readExternal() method. The readExternal() method throws IOException when an I/O error occurs. If the class of object being restored does not find, ClassNotException will be thrown.
void writeExternal(ObjectOutput outStream): writeExternal() method is used when we want to write an object’s fields to a stream. We need to write the logic to write data fields inside writeExternal() method. This method can throw an IOException when an I/O error occurs.
Most Asked Core Java Interview Questions and Answers : kzfaq.info/sun/PLyHJZXNdCXscoyL5XEZoHHZ86_6h3GWE1
Advance Java Interview Questions and Answers : kzfaq.info/sun/PLyHJZXNdCXsexOO1VQ4vs-BM2-8CKrixd
Java 8 Interview Questions and Answers : kzfaq.info/sun/PLyHJZXNdCXsdeusn4OM33415DCMQ6sUKy
Hibernate Interview Questions and Answers : kzfaq.info/sun/PLyHJZXNdCXsdC-p2186C6NO4FpadnCC_q
Spring Boot Interview Questions and Answers : kzfaq.info/sun/PLyHJZXNdCXsexOO1VQ4vs-BM2-8CKrixd
Angular Playlist : kzfaq.info/get/bejne/eaecarWCuMrVYoU.html
SQL Playlist : kzfaq.info/sun/PLyHJZXNdCXse86eLuwy5uZohd_bddE9Ni
GIT : kzfaq.info/sun/PLyHJZXNdCXscpl6pxOnL2lRWJlzvzjyZE
Subscriber and Follow Code Decode
Subscriber Code Decode : kzfaq.info
LinkedIn : www.linkedin.com/in/codedecodeyoutube/
Instagram : codedecode25
#singletondoublecheckedlocking #codedecode #javainterviewquestion

Пікірлер: 152
@naveenkumarkandregula1605
@naveenkumarkandregula1605 Жыл бұрын
I still cannot understand why these videos have so less likes. These are best and fastest explanation of the concepts. And thank you so much All of your videos contain only pure content and there is no more butterring in any of the video. By watching your channel I have bagged an offer in one of the MNC.
@CodeDecode
@CodeDecode Жыл бұрын
Many congratulations Naveen. Well deserved. Keep learning keep shining ⭐✨👍👍
@naveenkumarkandregula1605
@naveenkumarkandregula1605 Жыл бұрын
@@CodeDecode Thanks and Same to you.
@vinodsingh-zs7pb
@vinodsingh-zs7pb Жыл бұрын
Uu i
@vinodsingh-zs7pb
@vinodsingh-zs7pb Жыл бұрын
Oo ipoo
@rishiraj2548
@rishiraj2548 13 күн бұрын
❤️💯😎👍
@sayanbiswas8847
@sayanbiswas8847 Жыл бұрын
Your channel is gradually becoming a sure shot recipe for cracking the toughest and trickiest Java interviews. Keep up the good work.
@CodeDecode
@CodeDecode Жыл бұрын
Thanks Sayan. Yeah we had this vision since start 🙂👍
@saranyakaliannan3137
@saranyakaliannan3137 Жыл бұрын
One of the best tutorials I have come across in the recent times.very detailed explanation with examples.keep up the good work!!!
@CodeDecode
@CodeDecode Жыл бұрын
Thanks Saranya 🙂🙂👍
@dhineshm4798
@dhineshm4798 7 ай бұрын
After so many days, I got this concept clearly. Thanks!
@CodeDecode
@CodeDecode 6 ай бұрын
You’re welcome
@ajitpeshane8311
@ajitpeshane8311 3 ай бұрын
Perfect and Easy Explanation !!! very understandable
@divyapare1037
@divyapare1037 Жыл бұрын
Yes please add those videos as well..Very interesting and informative video..Thank you for this !!
@CodeDecode
@CodeDecode Жыл бұрын
Thanks Divya 🙂🙂
@arpitsik4649
@arpitsik4649 Жыл бұрын
Come daily mam, we want to hear your voice frequently. Thanks for the contribution and knowledge❤️
@CodeDecode
@CodeDecode Жыл бұрын
Thanks a lot Arpit. Sure we will try to be more frequent🙂🙂
@Suraj-dj5rk
@Suraj-dj5rk 4 ай бұрын
The explanation is really very precise & clear.. Thank you so much ❤
@rushabhmandvekar4411
@rushabhmandvekar4411 Жыл бұрын
A much needed video. Thank You Code Decode
@CodeDecode
@CodeDecode Жыл бұрын
Thanks Rushabh 🙂👍
@aparnawarade1159
@aparnawarade1159 Жыл бұрын
Perfect video. Please share the next video. I just started watching your videos from last 2 days and learned so much. Thank you so much for all the efforts.
@CodeDecode
@CodeDecode Жыл бұрын
Sure Aparna 👍👍🙂
@choudharysahabmusic3513
@choudharysahabmusic3513 Жыл бұрын
Very well, explained the entire concept. hats off!
@CodeDecode
@CodeDecode Жыл бұрын
Thanks
@sheiksahil7209
@sheiksahil7209 Жыл бұрын
I absolutely love your videos. It's a great channel for anyone who is preparing for interviews. Keep up the good work and wish you guys a successful future ahead. 💯💯
@CodeDecode
@CodeDecode Жыл бұрын
Thanks a ton 😊👍
@vinodchowdary4519
@vinodchowdary4519 Жыл бұрын
Thanks for all this information about serialization at one place. Please do make a follow up video as well with much more in depth concepts
@CodeDecode
@CodeDecode Жыл бұрын
Thanks Vinod 🙂🙂sure 👍👍
@sibinnagarajan5366
@sibinnagarajan5366 Жыл бұрын
Thanks a ton! Clearly explained
@CodeDecode
@CodeDecode Жыл бұрын
Thanks Sibin 🙂👍
@Shorts_n_Laughs
@Shorts_n_Laughs Жыл бұрын
Thank you for such an amazing content... Keep doing the great work 👏
@CodeDecode
@CodeDecode Жыл бұрын
Thanks Kishan 🙂👍
@shubhamgoyal1968
@shubhamgoyal1968 2 ай бұрын
really thanks! for this much hard work 🙂
@Aryabarta-ghxy
@Aryabarta-ghxy Жыл бұрын
Excellent explanation. Thanks a lot!
@CodeDecode
@CodeDecode Жыл бұрын
You are welcome!
@lalit28689
@lalit28689 Жыл бұрын
Thanks for the great explanation please bring the second part too asa soon as possible within 2-3 days...its help a lot...🙏🏻🙏🏻
@CodeDecode
@CodeDecode Жыл бұрын
Sure Lalit 🙂👍
@shrutik1863
@shrutik1863 Жыл бұрын
Thanks for the explanation, waiting for next video.
@CodeDecode
@CodeDecode Жыл бұрын
Sure Shruti we will upload next part soon👍
@rajeshbabu3029
@rajeshbabu3029 9 ай бұрын
Thank you so much!! Super explanation!!
@CodeDecode
@CodeDecode 9 ай бұрын
you're welcome
@sachinmunji1676
@sachinmunji1676 Жыл бұрын
Indeed cleanly explained and very knowledgeable thank you so much mam!!! Waiting for second part and would be more helpful if it is early☺☺
@CodeDecode
@CodeDecode Жыл бұрын
Thanks Sachin. Sure 🙂👍
@nidhichhabra2470
@nidhichhabra2470 Жыл бұрын
thanks for such great content..looking for the second part also
@CodeDecode
@CodeDecode Жыл бұрын
sure nidhi we will create it soon
@sumitbandal3384
@sumitbandal3384 Жыл бұрын
It's amazing explanation. Thanks for valuable knowledge. I learn many things from your video. Keep going up🙏😊
@CodeDecode
@CodeDecode Жыл бұрын
Thanks Sumit. Keep learning keep shining🙂🙂👍👍
@ashishsingh8222
@ashishsingh8222 5 ай бұрын
Very good explanation . Thank you for this .This is called pure content
@CodeDecode
@CodeDecode 5 ай бұрын
Thanks Ashish 👍
@chakravarthybatna1589
@chakravarthybatna1589 3 ай бұрын
All your interview questions videos are very useful for us, thank you ❤ for the great video
@CodeDecode
@CodeDecode 3 ай бұрын
Thanks for the nice words
@ajaykumarbhagat2827
@ajaykumarbhagat2827 Жыл бұрын
Great content and explanation , do create next part of this.
@CodeDecode
@CodeDecode Жыл бұрын
Sure 👍👍🙂🙂
@fewminuteswithanand
@fewminuteswithanand Жыл бұрын
Best video so far. Thank you mam. Like and subscribed. keep it up good work.
@CodeDecode
@CodeDecode Жыл бұрын
Thanks Anand 🙂🙂
@sahuprahalad8890
@sahuprahalad8890 Жыл бұрын
Thanks alot.. Nice explanation.. Keep it up. God bless you
@CodeDecode
@CodeDecode Жыл бұрын
Thanks 🙂👍
@cricketcrazy143
@cricketcrazy143 Жыл бұрын
As expected 👌
@CodeDecode
@CodeDecode Жыл бұрын
Thanks Sairam 🙂🙂
@jayaramreddy1497
@jayaramreddy1497 Жыл бұрын
Very nice today i have an interview ..i got confidence in this topic
@CodeDecode
@CodeDecode Жыл бұрын
All the best Jayaram 👍👍just keep your confidence up 👍👍
@Amit-tn5fq
@Amit-tn5fq Жыл бұрын
Best Explained mam... You will soon cross 1million mark... Language is easy, Keep it up...✌️👍
@CodeDecode
@CodeDecode Жыл бұрын
Thanks a lot Amit 🙂🙂
@dhruvkaushik7062
@dhruvkaushik7062 Жыл бұрын
Thanks for such an amazing content
@CodeDecode
@CodeDecode Жыл бұрын
You're welcome dhruv
@shaildesai1923
@shaildesai1923 Жыл бұрын
Thanks for very well explanation 🙏🙏
@CodeDecode
@CodeDecode Жыл бұрын
You're welcome shail
@sourabhjinde8191
@sourabhjinde8191 Жыл бұрын
Great. Thanks. Please make subsequent videos.
@CodeDecode
@CodeDecode Жыл бұрын
Sure👍🙂
@neha6000
@neha6000 Жыл бұрын
Best best very best ❤❤❤❤ today I learn more about this topic thank you
@CodeDecode
@CodeDecode Жыл бұрын
Thanks Neha 🙂👍
@neha6000
@neha6000 Жыл бұрын
@@CodeDecode no ma'am thank you for this usefull content
@pankhudigodhane5783
@pankhudigodhane5783 Жыл бұрын
perfect explainstion maam , keep making deep videos.!
@CodeDecode
@CodeDecode Жыл бұрын
Sure thanks Pankhudi 👍🙂
@KumarGaurav-xDsoCH
@KumarGaurav-xDsoCH Жыл бұрын
Back to basics. Please hold it for long ❤️❤️
@CodeDecode
@CodeDecode Жыл бұрын
sure
@governmentexams1416
@governmentexams1416 Жыл бұрын
Yes we need it
@akashsaha9366
@akashsaha9366 Жыл бұрын
Good explanation. Please make the second part
@CodeDecode
@CodeDecode Жыл бұрын
Sure Akash 👍🙂
@suhasinia4415
@suhasinia4415 5 ай бұрын
Thanks for detailed explanation, One of the best tutorial🙂
@CodeDecode
@CodeDecode 5 ай бұрын
Thanks
@YogeshHumbad
@YogeshHumbad 6 ай бұрын
Great Explanation
@CodeDecode
@CodeDecode 6 ай бұрын
Thanks
@vasarjun6567
@vasarjun6567 10 ай бұрын
perfect perfect perfect perfect explanation, thank you very much and I'm going to subscribe you❤
@CodeDecode
@CodeDecode 10 ай бұрын
Thanks 😊
@manognajoshik8465
@manognajoshik8465 Жыл бұрын
Finally after a long wait.... please do upload second part as well..and could you please also make some videos on microservice design patterns? Also, could you please let me know how an Eclipse workspace build can be triggered from eclipsec (not Eclipse GUI version) and also, does this way manage circular dependencies of the projects in the workspace? We are trying to automate the workspace setup since the application is very bulky. Just looking for some inputs.
@CodeDecode
@CodeDecode Жыл бұрын
Sure. Yeh ms design patterns are in pipeline 🙂👍
@nikitamehto5596
@nikitamehto5596 Жыл бұрын
Great explanation. Please make the 2nd part of this video. Also please make detailed video on executor service, future, callable.
@CodeDecode
@CodeDecode Жыл бұрын
Thanks Nikita. Sure 👍
@sheiksahil7209
@sheiksahil7209 Жыл бұрын
Yes ..please make a playlist on Executor Service Framework. It's a very hot topic for interviews nowadays. Thanks in advance
@AkashKumar-vc5yl
@AkashKumar-vc5yl Жыл бұрын
Maybe I am late, but it was a great video and would love to learn further on this.
@CodeDecode
@CodeDecode Жыл бұрын
Thanks Akash 🙂🙂
@harshwardhanshetty4683
@harshwardhanshetty4683 Жыл бұрын
Greatnesssssssssssssssssss best teaching thank you
@CodeDecode
@CodeDecode Жыл бұрын
Thanks harshwardhan
@dnyaneshwarinare8759
@dnyaneshwarinare8759 Жыл бұрын
Thanku so much mam.
@CodeDecode
@CodeDecode Жыл бұрын
You're welcome
@uvanana.
@uvanana. Жыл бұрын
Your an inspiration for me :)
@CodeDecode
@CodeDecode Жыл бұрын
And you guys are motivation for us❤️❤️. Your comments for love makes all these hard work all worth it !! Thanks for being irreplaceable part of our code decode family
@uvanana.
@uvanana. Жыл бұрын
@@CodeDecode ❤️❤️
@udayakantaswain7472
@udayakantaswain7472 Жыл бұрын
very good explanation. please upload the second part.
@CodeDecode
@CodeDecode Жыл бұрын
Sure thanks 🙂👍
@mukulkopulwar
@mukulkopulwar 3 ай бұрын
Thank you!!!
@CodeDecode
@CodeDecode 3 ай бұрын
You're welcome!
@kedarnathanubolu2295
@kedarnathanubolu2295 Жыл бұрын
With content full and good explanation madam have a great time 😊😊🙂🙂
@CodeDecode
@CodeDecode Жыл бұрын
Thanks 🙂🙂👍👍
@kedarnathanubolu2295
@kedarnathanubolu2295 Жыл бұрын
@@CodeDecode plz make vedio on collection madam
@CodeDecode
@CodeDecode Жыл бұрын
kzfaq.info/get/bejne/gcyfgbygu7umen0.html
@prasannareddy3954
@prasannareddy3954 Жыл бұрын
Mam may i know if microservice can call monolithic service? Example: if an application having microservices and they are not maintaing any database. So they have to consume another project service(Monolithic) and with their respone, we have to manuplate at our end and send response to the end users.
@ayushjain7555
@ayushjain7555 5 ай бұрын
One doubt if we are using hibernate then we can simply save our object into data base by calling session.save(obj) and this obj class need not to implements Serializable. Please help with this.
@yoshitamahajan353
@yoshitamahajan353 Ай бұрын
Thanks!!!
@CodeDecode
@CodeDecode 19 күн бұрын
You’re Welcome!
@yoshitamahajan353
@yoshitamahajan353 Ай бұрын
Please make video on junit mokito....
@siddharthatyagi6836
@siddharthatyagi6836 Жыл бұрын
Serialize/Deserialize with in java, than what is the use of Jackson/Gson API.
@hemantanahak5674
@hemantanahak5674 4 ай бұрын
Please share me one session of locking mechanism and its usage in multi thread invironment
@abhinavgoel4358
@abhinavgoel4358 Жыл бұрын
Thanks
@CodeDecode
@CodeDecode Жыл бұрын
🙂🙂
@amarthyaseshu683
@amarthyaseshu683 Жыл бұрын
👌
@CodeDecode
@CodeDecode Жыл бұрын
🙂🙂
@pranjalsingh1099
@pranjalsingh1099 Жыл бұрын
Very good explanation. Can you please make detail video on multithreading w.r.t to executor service,future,callable and interview question asked on these topic
@CodeDecode
@CodeDecode Жыл бұрын
Sure Pranjal. It's in pipeline 🙂🙂
@Vithal_Nivargi
@Vithal_Nivargi Жыл бұрын
Thank you mam! Can you please make video on how to prevent a java deserilize vulnerability...
@CodeDecode
@CodeDecode Жыл бұрын
Sure Vithal 🙂👍
@tejachowdary309
@tejachowdary309 Жыл бұрын
I am pretty new to this concept. I always have a query. In DB data is stored in rows and columns as user input and it is in readable format. But why do we say object is converted to byte stream and stored in DB ?
@CodeDecode
@CodeDecode Жыл бұрын
No problem Teja. Initially these doubts are bound to pop up in our mind. Good thing is that you are trying to clarify that👍👍. So first of all not all databases are rows and columns. These are relational dbs you are thinking about. There are many many many others available out in marker like no sql dbs like table db, like casandra etc etc. And second misconception here, not all objects in java are pojos. Even images, blobs, documents all these are objects too that we need to store in db. These have to converrd to bytes stream b4 storing them
@tejachowdary309
@tejachowdary309 Жыл бұрын
@@CodeDecode thank you for making me understand. So non relational db’s use this for storing images , pdfs etc ? Relational db like sql doesn’t need this right
@mohammedajazquadri7869
@mohammedajazquadri7869 Жыл бұрын
Thanks for making video on this topic And also make interview questions video on Multi threading
@CodeDecode
@CodeDecode Жыл бұрын
Sure 👍🙂🙂
@mrrishiraj88
@mrrishiraj88 Жыл бұрын
🙏🙏👍✌
@CodeDecode
@CodeDecode Жыл бұрын
🙂🙂
@robinbhargava111
@robinbhargava111 Жыл бұрын
Please make your videos in high quality(HD).
@CodeDecode
@CodeDecode Жыл бұрын
Hey Robin we have uploaded all our latest videos in high quality
@prakharsinha4145
@prakharsinha4145 9 сағат бұрын
can you please give these slides ?
@chauhanji8203
@chauhanji8203 Жыл бұрын
Pls second part😊😊😊😊
@CodeDecode
@CodeDecode Жыл бұрын
sure we will create it soon
@koraboinaraju9522
@koraboinaraju9522 Жыл бұрын
Hi can you please take one vedio consuming webservice using webclient and mono and flux .
@CodeDecode
@CodeDecode Жыл бұрын
Sure Raju 🙂👍
@challaprashanthreddy9799
@challaprashanthreddy9799 Жыл бұрын
Need role based authentication video
@CodeDecode
@CodeDecode Жыл бұрын
Sure 👍👍
@neeleshmohanty7380
@neeleshmohanty7380 Жыл бұрын
We want next video
@CodeDecode
@CodeDecode Жыл бұрын
Sure Neelesh 🙂🙂
@varunikrishna6517
@varunikrishna6517 Жыл бұрын
please make a video on the second part
@CodeDecode
@CodeDecode Жыл бұрын
Sure we will create video soon on it
@Praveen8982207
@Praveen8982207 Жыл бұрын
Kindly add second part of the video 🙏
@CodeDecode
@CodeDecode Жыл бұрын
Sure 👍👍
@ashwinibarge9234
@ashwinibarge9234 Жыл бұрын
please create the second part.
@CodeDecode
@CodeDecode Жыл бұрын
Sure we will create it soon
@priyanka0879
@priyanka0879 Жыл бұрын
Please do videos on Spring boot
@CodeDecode
@CodeDecode Жыл бұрын
kzfaq.info/sun/PLyHJZXNdCXsdXxY8wupiLenux2Yafn1lN
@priyanka0879
@priyanka0879 Жыл бұрын
@@CodeDecode thanks for your response
@routhuaravind6006
@routhuaravind6006 8 ай бұрын
memorize from @ 19:56
@pradeepchintalacheruvu2366
@pradeepchintalacheruvu2366 2 ай бұрын
Speed 1x = 2x
@CodeDecode
@CodeDecode Ай бұрын
We will reduce 😊
When You Get Ran Over By A Car...
00:15
Jojo Sim
Рет қаралды 14 МЛН
Дибала против вратаря Легенды
00:33
Mr. Oleynik
Рет қаралды 4,7 МЛН
NERF WAR HEAVY: Drone Battle!
00:30
MacDannyGun
Рет қаралды 46 МЛН
When You Get Ran Over By A Car...
00:15
Jojo Sim
Рет қаралды 14 МЛН