Module3 Definition
Module3 Definition
--------------------------------------------------------------------------------------------------------
What is an Exception?
An exception is a unexpected or unwanted triggered by the JVM during the
execution of the program which forces the jvm to abnormally terminate the
program.
types of exception
-------------------
checked exception (InterruptedException,IoException,SQLException..)
unchecked exception (RuntimeException)
What is immutability?
Whenever we create a String class object we cannot perform
any changes to the content of the object but if we try to
perform any changes to the content of the object then along with the changes
a new object is created. This behaviour of a String class object is known
as Immutability.
What is a Collection?
A Collection is a Container in which multiple individual objects are stored
as a single entity.
What is a Map?
It is a container in which the elements are stored in key value pair.
The key value pair is technically called as Entry.
What is thread?
A thread is a lightweight process.
Any program under execution is known as process.
A process that consumes less amount of CPU time and memory is known as
lightweight process.
Thread can be created in 2 ways
a. By extending from Thread class.
b. By implementing Runnable interface.
What is Synchronization?
It is the concept of making a method thread safe.
In java we can achieve synchronization by used “synchronized” keyword.
When we declare a method as synchronized then it can be accessed by only
one thread at a time.
Explain the role of start () method?
It is an inbuilt method present in Thread class.
An Actual thread gets created in Java Memory only when we call start ()
method.
It performs the following operations,
a) Registers thread with JVM.
b) Allocate resources needed for execution.
c) Internally calls start () method.
What is DEADLOCK?
Multiple threads on hold waiting for each other to complete execution is called
deadlock.