Serialization Notes Code Decode
Serialization Notes Code Decode
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.
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.
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.
Git is a version control system for tracking changes in computer files and
coordinating work on those files among multiple people. It is primarily used for
source code management in software development, but it can be used to keep track of
changes in any set of files. As a distributed revision control system it is aimed
at speed, data integrity, and support for distributed, non-linear workflows.
WHY JAVA 8?
->Significant reason for introducing Java 8 was to introduce Conciseness in code
-> If you have ever observed, with python ,Scala,we can do the same thing in very
less LOC.By mid 20s Java lost a large market due to some concept of FP to create
concise code base
There are lots of new features which were added in Java 8. Here is the list of
important features which are mostly asked as java 8 interview questions:
Lambda Expression
Stream API
Default methods in the interface
Functional Interface
Optional
Method references
Date API
Nashorn, JavaScript Engine
Functional interfaces are those interfaces which can have only one abstract
method .
Java can implicitly identify functional interface but still you can also annotate
it with @FunctionalInterface . It just give you the security that in case if u by
mistake add 2 abstract methods then Compiler will throw compile time error.
Method Reference :
EG : MethodReferenceDemo and FunctionalInterfaceDemo
Servlet ::
Servlet:
Takes the req, processes it and returns response object in most probably HTML
format.
Web Container:
Takes the request incase of Dynamic req and passes it to Deployment Descriptor or
web.xml file.
Server: