Java Interview Notes
Java Interview Notes
-------------------------------------------------------------------------
-------------------------------------------------
CLASSLOADER:
************
-------------------------------------------------------------------------
-------------------------------------------------
The heap memory area in the JVM is divided into two sections:
1.Young Generation:
Newly created objects start in the Young Generation. The Young
Generation is further subdivided into:
a.Eden space - all new objects start here, and initial memory is
allocated to them
b.Survivor spaces (FromSpace and ToSpace) - objects are moved here
from Eden after surviving one garbage collection cycle.When
objects are garbage collected from the Young Generation, it is a minor
garbage collection event.
2.Old Generation:
Objects that are long-lived are eventually moved from the Young
Generation to the Old Generation. When objects are garbage collected
from the Old Generation, it is a major garbage collection event.You can
use the -Xms and -Xmx flags to set the size of the initial and maximum
size of the Heap memory.
When an object is created, it is first put into the Eden space of the
young generation. Once a minor garbage collection happens, the live
objects from Eden are promoted to the FromSpace (Survivor 1). When the
next minor garbage collection happens, the live objects from both Eden
and FromSpace are moved to the ToSpace(Survivor 2).
e. Using Deserialization
ObjectInputStream objectInputStream = new ObjectInputStream(inputStream
);
Tester tester5 = (MyObject) objectInputStream.readObject();
7.What do you understand by an instance variable, class variable and a
local variable?
Instance variables are those variables that are accessible by all the
methods in the class. They are declared outside the methods and inside
the class. These variables describe the properties of an object and
remain bound to it at any cost.
All the objects of the class will have their copy of the variables for
utilization. If any modification is done on these variables, then only
that instance will be impacted by it, and all other class instances
continue to remain unaffected.
Example:
class Athlete {
public String athleteName;
public double athleteSpeed;
public int athleteAge;
}
8.Can you tell the difference between equals() method and equality
operator (==) in Java?
class Shape{
void draw(){System.out.println("drawing...");}
}
class Rectangle extends Shape{
void draw(){System.out.println("drawing rectangle...");}
}
class Circle extends Shape{
void draw(){System.out.println("drawing circle...");}
}
class Triangle extends Shape{
void draw(){System.out.println("drawing triangle...");}
}
class TestPolymorphism2{
public static void main(String args[]){
Shape s;
s=new Rectangle();
s.draw();
s=new Circle();
s.draw();
s=new Triangle();
s.draw();
}
}
Output:
drawing rectangle...
drawing circle...
drawing triangle...
class Bike{
int speedlimit=90;
}
class Honda3 extends Bike{
int speedlimit=150;
class Animal{
void eat(){System.out.println("animal is eating...");}
}
class Dog extends Animal{
void eat(){System.out.println("dog is eating...");}
}
class BabyDog1 extends Dog{
public static void main(String args[]){
Animal a=new BabyDog1();
a.eat();
}}
16.What is serialization?
To serialize an object means to convert its state to a byte stream so
that the byte stream can be reverted back into a copy of the object. A
Java object is serializable if its class or any of its superclasses
implements either the java.io.Serializable interface or its subinterface,
java.io.Externalizable. Deserialization is the process of converting the
serialized form of an object back into a copy of the object
17.What is JIT?
The Just-In-Time (JIT) compiler is a component of the Java™ Runtime
Environment that improves the performance of Java applications at run
time. Java programs consists of classes, which contain platform-neutral
bytecodes that can be interpreted by a JVM on many different computer
architectures.The JIT compiler helps improve the performance of Java
programs by compiling bytecodes into native machine code at run time.
class Mobile {
private String mobile_no;
}
Class Mobile HAS-A mobile_no object
interface I{}
class A{}
class B extends A implements I{}
Here, the relationship of B class would be:
B IS-A A
B IS-A I
B IS-A Object
You expect that unrelated classes would implement your interface. For
example, the interfaces Comparable and Cloneable are implemented by many
unrelated classes.
You want to specify the behavior of a particular data type, but not
concerned about who implements its behavior.
Rule 3 : InterfaceName.super.methodName()
If your class doesn’t extend any class and inherit multiple methods with
same signature from multiple interfaces which doesn’t belong to same
hierarchy, then override that method and from within body explicitly call
desired method as InterfaceName.super.methodName().
26.If there's abstract class then why interface has default methods java
8 onwards?
The reason we have default methods in interfaces is to allow the
developers to add new methods to the interfaces without affecting the
classes that implements these interfaces.
The String.intern() method puts the string in the String pool or refers
to another String object from the string pool having the same value.
The String objects are cached in the String pool, and it makes the String
immutable. The cached String literals are accessed by multiple clients.
So, there is always a risk, where action performs by one client affects
all other clients. For example, if one client performs an action and
changes the string value from Pressure to PRESSURE, all remaining clients
will also read that value. For the performance reason, caching of String
objects was important, so to remove that risk, we have to make the String
Immutable.
1. Eager Instantiation -
Thread safe
2. Classis Implementation
private Singelton(){
private Singelton(){
private Singelton(){
best way
To overcome this
Need to override clone method and throw clone not supported
exception.
So when we try to clone the singelton it will throw the exception.
If you don;t wont to return the exception then return the same
instace from the method.
Immutable class -
Once we create an object of a class we are not able to change the object.
If we are trying to change then we can get a new object.
LL:It uses a doubly linked list internally to store the elements. It can
store the duplicate elements. It maintains the insertion order and is not
synchronized. Elements stored in non Contiguous memory location.
----------------------------------------
Steps:
Calculate hash code of Key {“vishal”}. It will be generated as 118.
Calculate index by using index method it will be 6.
Create a node object as :
-----------------------------------------------
class Price{
Output: In hashcode
In hashcode
In hashcode
item: Apple price: 40
item: Orange price: 30
item: Banana price: 20
inserting duplicate object...
In hashcode
In equals
After insertion:
item: Apple price: 40
item: Orange price: 30
item: Banana price: 20
-------------------------
}
}
class Price{
@Override
public String toString() {
return "Price{" +
"item='" + item + '\'' +
", price=" + price +
'}';
}
public int hashCode(){
System.out.println("In hashcode");
int hashcode = 0;
hashcode = price*20;
hashcode += item.hashCode();
return hashcode;
}
-------------------------------------------
-------------------------------------------------
------------------------------------------------
Not Fail Fast : These iterators require extra memory for cloning of
collection. Ex : ConcurrentHashMap, CopyOnWriteArrayList
-------------------------------------------------------------------------
------------------------------------------------
// Getting Spliterator
Spliterator<String> namesSpliterator = names.spliterator();
// Traversing elements
namesSpliterator.forEachRemaining(System.out::println);
-----------------------------------
Permanent Generation:
Metadata such as classes and methods are stored in the Permanent
Generation. It is populated by the JVM at runtime based on classes in use
by the application. Classes that are no longer in use may be garbage
collected from the Permanent Generation.
You can use the -XX:PermGen and -XX:MaxPermGen flags to set the initial
and maximum size of the Permanent Generation.
MetaSpace in java 8:
Starting with Java 8, the MetaSpace memory space replaces the PermGen
space. The implementation differs from the PermGen and this space of the
heap is now automatically resized.
This avoids the problem of applications running out of memory due to the
limited size of the PermGen space of the heap. The Metaspace memory can
be garbage collected and the classes that are no longer used can be
automatically cleaned when the Metaspace reaches its maximum size.
------------------------------------------------------
Map vs FlatMap -
Map -
1. It applies a function on each element of stream and stores the
value returned by the function into a new Stream. This way one stream is
transformed into another e.g. a Stream of String is transformed into a
Stream of Integer where each element is length of corresponding Stream.
2. Key thing to remember is that the function used for
transformation in map() returns a single value
FlatMap -
1. If map() uses a function, which, instead of returning a
single value returns a Stream of values than you have a Stream of Stream
of values, and flatmap() is used to flat that into a Stream of values.
Diff -
3.Given a list of students, how do you get the name and percentage of
each student?
Map<String, Double> namePercentageMap =
studentList.stream().collect(Collectors.toMap(Student::getName,
Student::getPercentage));
4.Given a list of students, how do you get the subjects offered in the
college?
Set<String> subjects =
studentList.stream().map(Student::getSubject).collect(Collectors.toSet())
;
employeeList.stream().min(Comparator.comparingInt(Employee::getAge));
How do you get current date and time using Java 8 features?
1. Consumer :
The consumer interface accepts one argument but there is
no return value.
The name of function inside this interface is accept.
The below consumer is accepting one argument and print
it in upper case. But there is no return value.
@FunctionalInterface
Public interface Consumerr<T>{
void accept(T t);
}
Consumer<String> ucConsumer = (s) ->
System,out.println(s.toUpperCase());
2. Bi Consumer :
The extension of the Consumer which is BiConsumer
accepts two arguments and return nothing.
@FunctionalInterface
Public interface BiConsumerr<T,U>{
void accept(T t,U u);
}
BiConsumerr<String,String> biConsumer = (x,y) ->
System,out.println("x : "+x+"y : "+y);
3. predicate :
Predicate will accept one argument, do some processing
and then return boolean
@FunctionalInterface
Public interface Predicate<T>{
void test(T t);
}
Predicate<Integer> p = (i) -> {return i % 2 == 0});
4. Bi Predicate :
Instead of one argument BiPredicate will accept two
arguments and return nothing.
5. Function :
This interface accepts one argument and return a value
after the required processing. It is defined as below. The required
processing logic will be executed on invocation of the apply method.
In the below example, the Function is accepting one
string and also returns one string.
@FunctionalInterface
Public interface Function<T,R> {
R apply(T t);
}
static Function <String,String> upperCase = (name) ->
name.toUpperrCase();
6. BIFUNCTION :
The BiFunction is similar to Function except it accepts
two inputs whereas Function accepts one argument. The sample code for the
BiFunction interface is given below. In the below interface code T, U are
the inputs and R is the single output.
-------------------------------------------------------------------------
-----------------------------------
EXCEPTION HANDLING:
*******************
If an exception occurs, the catch block that matches the exception being
thrown is executed, if not, all catch blocks are ignored.
The finally block is always executed after the try block exits, whether
an exception was thrown or not inside it.
-------------------------------------------------------------------------
-----------------------------
class ParentClass{
int a;
ParentClass(int a){
System.out.println("Inside ParentClass parameterized
constructor!");
this.a = a;
}
ParentClass(){
System.out.println("Inside ParentClass default
constructor!");
}
}
class ChildClass extends ParentClass{
ChildClass(){
System.out.println("Inside ChildClass constructor!!");
}
}
public class ConstructorInInheritance {
}
}
Output:
Inside ParentClass default constructor!
Inside ChildClass constructor!!
-------------------------------------------------------------------------
-----------------------------
SOLID PRINCIPLES:
*****************
SOLID Principle -
Single Responsibility Principle (SRP)
Open-Closed Principle (OCP)
Liskov Substitution Principle (LSP)
Interface Segregation Principle (ISP)
Dependency Inversion Principle (DIP)
DESIGN PATTERNS:
****************
1 Singleton Pattern:
Eager initialization :
public class EagerInitializedSingleton
{
private static final
EagerInitializedSingleton instance = new EagerInitializedSingleton();
// eager
private
EagerInitializedSingleton(){}
public static
EagerInitializedSingleton getInstance(){
return instance;
}
}
MULTITHREADING:
***************
start method can't be invoked more than once on same object otherwise it
will throw java.lang.IllegalThreadStateException.
As already stated that in case of calling start method a new thread is
created along with the current thread so atleast two threads are there
and hence multithreading is introduced.
myThread.start();
try
{
myThread.sleep(5000);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
}
It is the main thread which is going to sleep not myThread. Because, when
you call sleep() method, it is currently executing thread which is going
to sleep, not on which you have called it.
Let's say that we want to have an Integer value that will be bundled with
the specific thread:
Methods -
1. Object get() - returns the value of thread local variable associated
with current Thread.
2. Object initialValue() - returns the initial value of thread local
variable associated with current thread. (default value NULL)
3. void set(Object newValue) - to set a new value to thread local
4. void remove() -to remove the value of thread local variable associated
with current thread
---------------------------------------------------------
--------------------------------------------------------
Java Concurrency API defines the following three executor interfaces that
covers everything that is needed for creating and managing threads -
The submit() method of executor service submits the task for execution by
a thread. However, it doesn’t know when the result of the submitted task
will be available. Therefore, it returns a special type of value called a
Future which can be used to fetch the result of the task when it is
available.
-----------------------------------------------------------------
class GunFight {
private int bullets = 40;
bullets--;
}
System.out.println(
"The firing process is complete");
}
-------------------------------------------------------------------------
--------------------------------------------
6. Two ways to use threads in Java? Which one is preferred and Why? --
What is the actual need to use join() method when we are working with
threads? -- How does this this differ from sleep() and yield()?
7. Can I use synchronized keyword with Static methods? If not, then why?
If yes, what is the consequence?
8. Find all possible pairs from a given integer array whose sum is equal
to a pre-defined integer x. - [1, 2, 3, 4, 5, 6] & x = 7 SO ANS = [(1,
6), (6, 1), (2, 5), (5, 2), (3, 4), (4, 3)] - Brute Force & Hashing
10. Given an integer array - remove all the duplicates. - Brute Force and
Hashing.
11. How to identify the from the random char array , whether it is
palindrom or not.
for(char c : chars) {
if(charsCount.containsKey(c)) {
charsCount.put(c, charsCount.get(c)+1);
}else
charsCount.put(c, 1);
}
--------------------------------------------------------------------
Design a class such that only one instance of the class and any of its
sub-classes can
be created. To clarify: Assume A is such a class and B is derived from A.
B does not
have any special code apart from extending A new A(); // works fine. new
A(); // causes
an exception new B(); // works fine as this is the first instance of B
new B(); // causes an
exception.
Design a new implementation of the Map interface which will also keep a
count of all the
calls to add a key value pair in the Map. It should count the calls to
put, putAll and
putIfAbsent methods. The implementation should also be able to provide
all the features
of any Map implementation that user wants. (e.g. HashMap, TreeMap etc)
You have received a csv file from stock exchange in following format:
timestamp,
symbol, price, qty, account, buy/sell This file may have millions of
records and
represents the trading activity for the day. The file is not sorted You
need to choose the
most optimal collections for holding this data in order to provide
analytics efficiently.
Write a Unix command to give the names of 10 last modified files in the
current
directory.
We have two tables - T1 and T2. Both have a VARCHAR column called ID in
both the
tables. Write a query to get the count of each ID across both the tables.
e.g. T1: | T2: ID
| ID --- | --- A | B B | C C | D Expected output: ID ---- A, 1 B, 2 C, 2
D, 1
We have a Parent class with 2 methods walk and run. We have a child class
which overrides both the methods. Both child class methods just call
their respective Super implementation. Parent class run method calls
walk(). class Parent Parent p = new Child(); p.run(); Tell the order in
which each method is called
Explain what the following command does on Unix: chmod 764 file1
We have a table called BookAuthor. It has two columns Book and Author,
Book being unique column. Write a query to find the names of the authors
who have written more than 10 books.
Given an array of n integers and a number k, find the pairs of numbers in
the array such that the difference between the pair is k. Find the
optimal solution with and without extra storage
return out.toString();
}
}
Q.inputArr[] = {3,1,5,2,7,1}
S >= 7 (sum of subarray)
Write a program which returns the size of the smallest subarray whose sum
is equal to or greater than S.
-------------------------------------------------------------------------
------------------------------------------
----------------------------------------------------------
MICROSERVICES:
**************
https://www.edureka.co/blog/microservices-design-patterns
API gateway: it acts as a proxy between client and backend services and
routes the requests to the corres microservice. it can decompose a single
client req to multiple requests to backend services.
auth,authenticationa nd SSl certification can be done in api gateway
Service registry -
Microservice -> (When service goes up/dpwn) -> Service Manager ->
Service registry
phone book
Step1 - client will told service discovery abt he wants to connect with
service2
Step2 - Service discovery will connect with service2 and told it abt
client.
- Microservices Arcitecture
-- SAGA Pattern
-- Service Discovery
-- Netflix Eureka etc.
-- Client Side
-- Server Side
-- Pros and Cons of the above
-- Load Balancer
-- Nginx etc.
-- API Gateway
-- Kong etc.
-- Centralized Configuration
-- Consul
-- Ansible
-- Chef
-- Caching Mechanism
-- Redis
-- Containerization
-- Docker
-- Kubernetes
-- Centralized Logging
-- Zipkin etc.
-- Migration
-- Things to consider when migrating a Monolith application to
Microservices.
---------------------
ResponseEntity<User> response
= new RestTemplate().getForEntity(
"http://localhost:8080/users/{userId}",
User.class, params);
Therefore, you can use the Circuit Breaker Design Pattern to overcome
this problem. With the help of this pattern, the client will invoke a
remote service through a proxy. This proxy will basically behave as an
electrical circuit breaker. So, when the number of failures crosses the
threshold number, the circuit breaker trips for a particular time period.
Then, all the attempts to invoke the remote service will fail within this
timeout period. After the timeout expires, the circuit breaker allows a
limited number of test requests to pass through it. If those requests
succeed, the circuit breaker resumes back to the normal operation.
Otherwise, if there is a failure, the timeout period begins again.
hibernate
design patterns
SQL:
****
1.Types of join
2.diff between delete, drop and truncate
3.DDL and DML
4.cluster and non cluster index
5.What is a Schema? schema is a logical collection of database objects
such as tables, views, stored procedures, indexes, triggers, functions.
GRANT & REVOKE are the popular members of the SQL family. These are the
types of DCL commands that are used to assign permission to the users to
perform a different task. The GRANT command is used for permitting the
users whereas the REVOKE command is used for removing the authorization.
Table :
ID FName SName LName Salary
1 Har preet Singh 30000
2 Ashu NULL Rana 50000
3 NULL Vinay Thakur 40000
4 NULL Vinay NULL 10000
5 NULL NULL Rajveer 60000
6 Manjeet Singh NULL 60000
SPRINGBOOT:
***********
For example:
Add Spring boot actuator started dependancy and enable the below
properties
management.security.enabled=true
security.basic.enabled=true
security.user.name=admin
security.user.password=admin
-------------
@transaction
spring security
spring mvc
asynch in spring
exception handling
spring AOP
ioc and DI
jwt token
flat map
restcontroller
@componentScan exclude
rest template
microservcie comm
CompletableFuture interface
elasticsearch
hashing
kafka
deployment
authentication and authorization
why apigateway
design patterns
Deliverables
• List of classes/objects that you see in the problem
• Just include class declaration, member variables and method
signatures (do not provide method implementation)
• Types of relationships in these classes
• No need of getter, setter and default constructors
• Do not write any DAO and Controllers
• No need write any annotations
spring security:
https://www.youtube.com/watch?v=rBNOc4ymd1E&ab_channel=JavaTechie
https://www.javatpoint.com/spring-mvc-tutorial
https://www.geeksforgeeks.org/spring-boot-spring-data-jpa/
If you are using spring profiles, you can have multiple profiles in one
single .yml file
While retrieving the values from .yml file we get the value as whatever
the respective type (int, string etc.) is in the configuration
What is Spring?
=> The Spring framework provides comprehensive infrastructure support
for developing Java applications.
=> Spring framework has some best feature like Dependency Injection,
Inversion of Control
=> By using spring framework most of the bioler plate code will get
removed
scopes in spring:
singleton : This scopes the bean definition to a single instance per
Spring IoC container (default).
prototype : This scopes a single bean definition to have any number of
object instances.
request : This scopes a bean definition to an HTTP request. Only valid in
the context of a web-aware Spring ApplicationContext.
session : This scopes a bean definition to an HTTP session. Only valid in
the context of a web-aware Spring ApplicationContext.
global-session : This scopes a bean definition to a global HTTP session.
Only valid in the context of a web-aware Spring ApplicationContext.
Spring boot -
annotations -
2. @RequestMapping -
- Can be applied over a class or method
@RequestMapping("path", Method=httpmethod)
http://localhost:8080/springmvc/hello/101?param1=10
@RequestMapping("/hello/{id}")
public String getDetails(
@PathVariable(value="id") String id,
@RequestParam(value="param1", required=true) String
param1,
@RequestParam(value="param2", required=false) String
param2){
.......
}
4. @Component/@Service/@Repository/@Controller -
------@Controller ------------
@RestController
|
@Component ---
-------@Service
|
------@Repository
-------------------------------------------------------------------------
-------------
@Component
public class CarEngineImpl implements Engine{
@Component
public class BikeEngineImpl implements Engine{
@Autowired
BikeEngineImpl engine; - will work fine but we are
using implement
BeanFactory VS ApplicationContext -
Spring provides two kinds of IOC container - one is BeanFactory and
other is ApplicationContext.
Both are Java Interfaces and ApplicationContext extends
BeanFactory.
BeanFactory provides basic IOC and DI feature while
ApplicationContext provides enhanced feature.
BeanFactory does not support internationlization but
applicationContext provides support for it.
ApplicationContext have an ability to publish the events for beans
which are registered as listners.
ApplicationContext uses eager initilization while BeanFactory uses
lazy intilization.
Go for applicationContext as it give some enhanced feature but if
there is memory issue (applet apps)
and you don't wont enhanced feature then use beanfactory
BeanFactory -
The root interface for accessing a Spring bean container
ApplicationContext -
Central interface to provide configuration for an application.
Provides -
1. Bean factory methods for accessing application components
2. The ability to load file resources in a generic fashion
3. The ability to publish events to registered listeners
4. The ability to resolve messages, supporting
internationalization
<bean id="helloWorld"
class="net.javaguides.spring.ioc.HelloWorld">
<property name="message" value="Hello World!" />
</bean>
@Configuartion
public class ApplicationConfiguartion{
@Bean
public HelloWorld hello{
return new HelloWorld();
}
}
ApplicationContext Vs WebApplicationContext -
Web Application context extended Application Context which is
designed to work with the standard javax.servlet.ServletContext
so it's able to communicate with the container.
BeanPostProcessor -
Allows custom modification for newly created spring bean instances.
If you want to implement some custom logic once spring container
finishes instantiating, configuring and initilizing a bean
we can plug in one or more spring bean post processor. In case of
multiple we can control the order by using Ordered interface.
registerShutdownHook -
In spring, registerShutdownHook() method is used to shut down IoC
container in non-web applications.
It shuts down IoC container gracefully.
In non-web Based application we need to call this but in web based
application, application context takes care of this.
KAFKA:
******
Kafka Components -
Topic - group of message belonging to the same type
Publisher - that can publish the message to the topic
Brokers - set of server where publish message are copied
Consumer - that subscribe to the various topic and pulls the data
from broker.
PRODUCER API:
CONSUMER API:
Properties props = new Properties();
props.put("bootstrap.servers", "localhost:9092");
props.put("group.id", "test");
props.put("enable.auto.commit", "true");
props.put("auto.commit.interval.ms", "1000");
props.put("session.timeout.ms", "30000");
props.put("key.deserializer",
"org.apache.kafka.common.serialization.StringDeserializer");
props.put("value.deserializer",
"org.apache.kafka.common.serialization.StringDeserializer");
KafkaConsumer<String, String> consumer = new KafkaConsumer
<String, String>(props);
//Kafka Consumer subscribes list of topics here.
consumer.subscribe(Arrays.asList(topicName))
while (true) {
ConsumerRecords<String, String> records = con-sumer.poll(100);
for (ConsumerRecord<String, String> record : records)
We have one topic, and there are four partitions. So, if we have only one
consumer in a group, it reads from all four partitions. If you have two,
each of them reads two partitions. If you have three, the arrangement may
be something like a single consumer reading two partitions and others own
a single partition each. So, the fundamental concept is that the
consumers do not share a partition. There is no way we can read the same
message more than once.
-----------------------------------
Text search
You want Elasticsearch when you're doing a lot of text search, where
traditional RDBMS databases are not performing really well (poor
configuration, acts as a black-box, poor performance). Elasticsearch is
highly customizable, extendable through plugins. You can build robust
search without much knowledge quite fast.
One of the Elasticsearch Architects I spoke with said that 80% of the
data Elasticsearch works with in companies is unstructured, while 20% is
structured. It's the unstructured data that companies are looking at to
discover rare or unusual data patterns.
bool query
The default query for combining multiple leaf or compound query clauses,
as must, should, must_not, or filter clauses.
---------------------
APPLICATION LOGIN:
******************
What may be easier, and even more secure, is using an SHA-256 hash as
"encryption". Simply hash the password, store it in the server, and when
the user tries to log in again, compare the hash stored by the server to
the hash of the password he attempted to use. That way, the password is
never sent through the network, and its almost impossible to reverse-hash
SHA-256!
---------------------------------------------------------------------
DOCKER:
*******
Developer -> Docker File -> Docker Imgae -> Docker Hub (cloud) --> Pull
Image
Docker Image
Docker Architecture -
Benefits of Docker -
1. Build app only once and run any where (Docker image is same)
2. Portability
3. Version Control
4. Isolocation - app runs in single container and not interfear with
other apps
5. Deployments made easy
-------------------------------------------------------
-------------------------------------------------------------------------
----------------------
REST AND SOAP:
**************
SOAP we can use with any application layer protocol such as HTTP, SMTP,
TCP or UDP
SOAP retuns data to the receiver in XML format.
REST uses HTTP protocol for data transmission. REST returns data in JSON,
XML, HTML, YAML,
Plain text or any other format.
----------------------------------------------------END------------------
-----------------------------------------