No video

Serialization Deserialization & Externalization | Java Interview Questions and Answer | 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/u...
Course Description Video :
yt.openinapp.c...
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 : • Core Java frequently a...
Advance Java Interview Questions and Answers : • Advance Java Interview...
Java 8 Interview Questions and Answers : • Java 8 Interview Quest...
Hibernate Interview Questions and Answers : • Hibernate Interview Qu...
Spring Boot Interview Questions and Answers : • Advance Java Interview...
Angular Playlist : • Angular Course Introdu...
SQL Playlist : • SQL Interview Question...
GIT : • GIT
Subscriber and Follow Code Decode
Subscriber Code Decode : www.youtube.co...
LinkedIn : / 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

    Ай бұрын

    ❤️💯😎👍

  • @sayanbiswas8847
    @sayanbiswas88472 жыл бұрын

    Your channel is gradually becoming a sure shot recipe for cracking the toughest and trickiest Java interviews. Keep up the good work.

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    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
    @dhineshm47988 ай бұрын

    After so many days, I got this concept clearly. Thanks!

  • @CodeDecode

    @CodeDecode

    8 ай бұрын

    You’re welcome

  • @divyapare1037
    @divyapare10372 жыл бұрын

    Yes please add those videos as well..Very interesting and informative video..Thank you for this !!

  • @CodeDecode

    @CodeDecode

    Жыл бұрын

    Thanks Divya 🙂🙂

  • @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 👍👍🙂

  • @arpitsik4649
    @arpitsik46492 жыл бұрын

    Come daily mam, we want to hear your voice frequently. Thanks for the contribution and knowledge❤️

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    Thanks a lot Arpit. Sure we will try to be more frequent🙂🙂

  • @vinodchowdary4519
    @vinodchowdary45192 жыл бұрын

    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

    2 жыл бұрын

    Thanks Vinod 🙂🙂sure 👍👍

  • @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 😊👍

  • @choudharysahabmusic3513
    @choudharysahabmusic3513 Жыл бұрын

    Very well, explained the entire concept. hats off!

  • @CodeDecode

    @CodeDecode

    Жыл бұрын

    Thanks

  • @rushabhmandvekar4411
    @rushabhmandvekar44112 жыл бұрын

    A much needed video. Thank You Code Decode

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    Thanks Rushabh 🙂👍

  • @ashishsingh8222
    @ashishsingh82226 ай бұрын

    Very good explanation . Thank you for this .This is called pure content

  • @CodeDecode

    @CodeDecode

    6 ай бұрын

    Thanks Ashish 👍

  • @chakravarthybatna1589
    @chakravarthybatna15895 ай бұрын

    All your interview questions videos are very useful for us, thank you ❤ for the great video

  • @CodeDecode

    @CodeDecode

    4 ай бұрын

    Thanks for the nice words

  • @neha6000
    @neha60002 жыл бұрын

    Best best very best ❤❤❤❤ today I learn more about this topic thank you

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    Thanks Neha 🙂👍

  • @neha6000

    @neha6000

    2 жыл бұрын

    @@CodeDecode no ma'am thank you for this usefull content

  • @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 🙂👍

  • @sumitbandal3384
    @sumitbandal33842 жыл бұрын

    It's amazing explanation. Thanks for valuable knowledge. I learn many things from your video. Keep going up🙏😊

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    Thanks Sumit. Keep learning keep shining🙂🙂👍👍

  • @sachinmunji1676
    @sachinmunji16762 жыл бұрын

    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 🙂👍

  • @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 🙂🙂

  • @jayaramreddy1497
    @jayaramreddy14972 жыл бұрын

    Very nice today i have an interview ..i got confidence in this topic

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    All the best Jayaram 👍👍just keep your confidence up 👍👍

  • @akashsaha9366
    @akashsaha93662 жыл бұрын

    Good explanation. Please make the second part

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    Sure Akash 👍🙂

  • @suhasinia4415
    @suhasinia44156 ай бұрын

    Thanks for detailed explanation, One of the best tutorial🙂

  • @CodeDecode

    @CodeDecode

    6 ай бұрын

    Thanks

  • @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

  • @pankhudigodhane5783
    @pankhudigodhane5783 Жыл бұрын

    perfect explainstion maam , keep making deep videos.!

  • @CodeDecode

    @CodeDecode

    Жыл бұрын

    Sure thanks Pankhudi 👍🙂

  • @ajitpeshane8311
    @ajitpeshane83115 ай бұрын

    Perfect and Easy Explanation !!! very understandable

  • @ajaykumarbhagat2827
    @ajaykumarbhagat2827 Жыл бұрын

    Great content and explanation , do create next part of this.

  • @CodeDecode

    @CodeDecode

    Жыл бұрын

    Sure 👍👍🙂🙂

  • @nidhichhabra2470
    @nidhichhabra2470 Жыл бұрын

    thanks for such great content..looking for the second part also

  • @CodeDecode

    @CodeDecode

    Жыл бұрын

    sure nidhi we will create it soon

  • @Shorts_n_Laughs
    @Shorts_n_Laughs Жыл бұрын

    Thank you for such an amazing content... Keep doing the great work 👏

  • @CodeDecode

    @CodeDecode

    Жыл бұрын

    Thanks Kishan 🙂👍

  • @shrutik1863
    @shrutik1863 Жыл бұрын

    Thanks for the explanation, waiting for next video.

  • @CodeDecode

    @CodeDecode

    Жыл бұрын

    Sure Shruti we will upload next part soon👍

  • @Suraj-dj5rk
    @Suraj-dj5rk6 ай бұрын

    The explanation is really very precise & clear.. Thank you so much ❤

  • @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 🙂👍

  • @sourabhjinde8191
    @sourabhjinde81912 жыл бұрын

    Great. Thanks. Please make subsequent videos.

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    Sure👍🙂

  • @Aryabarta-ghxy
    @Aryabarta-ghxy Жыл бұрын

    Excellent explanation. Thanks a lot!

  • @CodeDecode

    @CodeDecode

    Жыл бұрын

    You are welcome!

  • @YogeshHumbad
    @YogeshHumbad8 ай бұрын

    Great Explanation

  • @CodeDecode

    @CodeDecode

    8 ай бұрын

    Thanks

  • @shaildesai1923
    @shaildesai1923 Жыл бұрын

    Thanks for very well explanation 🙏🙏

  • @CodeDecode

    @CodeDecode

    Жыл бұрын

    You're welcome shail

  • @vasarjun6567
    @vasarjun656711 ай бұрын

    perfect perfect perfect perfect explanation, thank you very much and I'm going to subscribe you❤

  • @CodeDecode

    @CodeDecode

    11 ай бұрын

    Thanks 😊

  • @manognajoshik8465
    @manognajoshik84652 жыл бұрын

    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 🙂👍

  • @rajeshbabu3029
    @rajeshbabu302911 ай бұрын

    Thank you so much!! Super explanation!!

  • @CodeDecode

    @CodeDecode

    11 ай бұрын

    you're welcome

  • @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 🙂🙂

  • @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 ❤️❤️

  • @KumarGaurav-xDsoCH
    @KumarGaurav-xDsoCH Жыл бұрын

    Back to basics. Please hold it for long ❤️❤️

  • @CodeDecode

    @CodeDecode

    Жыл бұрын

    sure

  • @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

    Жыл бұрын

    kzread.info/dash/bejne/fZqjsLuohrioeqw.html

  • @udayakantaswain7472
    @udayakantaswain74722 жыл бұрын

    very good explanation. please upload the second part.

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    Sure thanks 🙂👍

  • @sibinnagarajan5366
    @sibinnagarajan53662 жыл бұрын

    Thanks a ton! Clearly explained

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    Thanks Sibin 🙂👍

  • @dhruvkaushik7062
    @dhruvkaushik7062 Жыл бұрын

    Thanks for such an amazing content

  • @CodeDecode

    @CodeDecode

    Жыл бұрын

    You're welcome dhruv

  • @shubhamgoyal1968
    @shubhamgoyal19684 ай бұрын

    really thanks! for this much hard work 🙂

  • @harshwardhanshetty4683
    @harshwardhanshetty4683 Жыл бұрын

    Greatnesssssssssssssssssss best teaching thank you

  • @CodeDecode

    @CodeDecode

    Жыл бұрын

    Thanks harshwardhan

  • @dnyaneshwarinare8759
    @dnyaneshwarinare8759 Жыл бұрын

    Thanku so much mam.

  • @CodeDecode

    @CodeDecode

    Жыл бұрын

    You're welcome

  • @challaprashanthreddy9799
    @challaprashanthreddy9799 Жыл бұрын

    Need role based authentication video

  • @CodeDecode

    @CodeDecode

    Жыл бұрын

    Sure 👍👍

  • @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 🙂🙂

  • @hemantanahak5674
    @hemantanahak56745 ай бұрын

    Please share me one session of locking mechanism and its usage in multi thread invironment

  • @yoshitamahajan353
    @yoshitamahajan3532 ай бұрын

    Please make video on junit mokito....

  • @mohammedajazquadri7869
    @mohammedajazquadri78692 жыл бұрын

    Thanks for making video on this topic And also make interview questions video on Multi threading

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    Sure 👍🙂🙂

  • @ayushjain7555
    @ayushjain75557 ай бұрын

    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.

  • @cricketcrazy143
    @cricketcrazy1432 жыл бұрын

    As expected 👌

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    Thanks Sairam 🙂🙂

  • @Vithal_Nivargi
    @Vithal_Nivargi2 жыл бұрын

    Thank you mam! Can you please make video on how to prevent a java deserilize vulnerability...

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    Sure Vithal 🙂👍

  • @mukulkopulwar
    @mukulkopulwar4 ай бұрын

    Thank you!!!

  • @CodeDecode

    @CodeDecode

    4 ай бұрын

    You're welcome!

  • @prasannareddy3954
    @prasannareddy39542 жыл бұрын

    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.

  • @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

  • @siddharthatyagi6836
    @siddharthatyagi6836 Жыл бұрын

    Serialize/Deserialize with in java, than what is the use of Jackson/Gson API.

  • @robinbhargava111
    @robinbhargava111 Жыл бұрын

    Please make your videos in high quality(HD).

  • @CodeDecode

    @CodeDecode

    Жыл бұрын

    Hey Robin we have uploaded all our latest videos in high quality

  • @yoshitamahajan353
    @yoshitamahajan3532 ай бұрын

    Thanks!!!

  • @CodeDecode

    @CodeDecode

    Ай бұрын

    You’re Welcome!

  • @ashwinibarge9234
    @ashwinibarge9234 Жыл бұрын

    please create the second part.

  • @CodeDecode

    @CodeDecode

    Жыл бұрын

    Sure we will create it soon

  • @Praveen8982207
    @Praveen8982207 Жыл бұрын

    Kindly add second part of the video 🙏

  • @CodeDecode

    @CodeDecode

    Жыл бұрын

    Sure 👍👍

  • @koraboinaraju9522
    @koraboinaraju95222 жыл бұрын

    Hi can you please take one vedio consuming webservice using webclient and mono and flux .

  • @CodeDecode

    @CodeDecode

    Жыл бұрын

    Sure Raju 🙂👍

  • @governmentexams1416
    @governmentexams1416 Жыл бұрын

    Yes we need it

  • @amarthyaseshu683
    @amarthyaseshu6832 жыл бұрын

    👌

  • @CodeDecode

    @CodeDecode

    Жыл бұрын

    🙂🙂

  • @chauhanji8203
    @chauhanji8203 Жыл бұрын

    Pls second part😊😊😊😊

  • @CodeDecode

    @CodeDecode

    Жыл бұрын

    sure we will create it soon

  • @abhinavgoel4358
    @abhinavgoel43582 жыл бұрын

    Thanks

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    🙂🙂

  • @varunikrishna6517
    @varunikrishna6517 Жыл бұрын

    please make a video on the second part

  • @CodeDecode

    @CodeDecode

    Жыл бұрын

    Sure we will create video soon on it

  • @neeleshmohanty7380
    @neeleshmohanty73802 жыл бұрын

    We want next video

  • @CodeDecode

    @CodeDecode

    Жыл бұрын

    Sure Neelesh 🙂🙂

  • @mrrishiraj88
    @mrrishiraj882 жыл бұрын

    🙏🙏👍✌

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    🙂🙂

  • @prakharsinha4145
    @prakharsinha4145Ай бұрын

    can you please give these slides ?

  • @priyanka0879
    @priyanka08792 жыл бұрын

    Please do videos on Spring boot

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    kzread.info/head/PLyHJZXNdCXsdXxY8wupiLenux2Yafn1lN

  • @priyanka0879

    @priyanka0879

    2 жыл бұрын

    @@CodeDecode thanks for your response

  • @routhuaravind6006
    @routhuaravind600610 ай бұрын

    memorize from @ 19:56

  • @pradeepchintalacheruvu2366
    @pradeepchintalacheruvu23663 ай бұрын

    Speed 1x = 2x

  • @CodeDecode

    @CodeDecode

    3 ай бұрын

    We will reduce 😊