Q #5) What do you mean by What is meant by
What are the features in JAVA? Constructor? Interface?
Ans: Features of Java:
Ans: Multiple inheritance
cannot be achieved in
Ans: The points given below java. To overcome this
explain what a Constructor is problem Interface concept
in detail: is introduced.
Oops concepts
When a new object is created An interface is a template
in a program a constructor which has only method
gets invoked corresponding to declarations and not the
Object-oriented the class. method implementation.
The constructor is a method
which has the same name as
Inheritance class name.
If a user doesn’t create a
constructor implicitly a default
Encapsulation constructor will be created.
The constructor can be
Polymorphism overloaded.
If the user created a
constructor with a parameter
then he should create another
constructor explicitly without a
Abstraction parameter.
Platform independent: A single
program works on different
platforms without any
modification.
High Performance: JIT (Just In
Time compiler) enables high
performance in Java. JIT converts
the bytecode into machine
language and then JVM starts the
execution.
Multi-threaded: A flow of
execution is known as a Thread.
JVM creates a thread which is
called main thread. The user can
create multiple threads by
extending the thread class or by
implementing Runnable interface.
What is
meant
by
Ordered
Q #25) What are all and
the Classes and Sorted
Q #16) What is Interfaces that are in Ans: Difference between
meant by Abstract available in the collectio HashSet and TreeSet can be
class? collections? ns? seen below:
Ans: We can create
the Abstract class by
using “Abstract”
keyword before the HashSet TreeSet
class name. An
abstract class can Ans: Given below are
have both “Abstract” the Classes and
methods and “Non- Interfaces that are
abstract” methods that available in
are a concrete class. Collections: Ans:
Inserted elements are in random Maintain
order s the
elements
in the
sorted
order
Can able to store null objects Couldn’t
store null
objects
Ordered
Interfaces: :
Performance is fast Perform
ance is
slow
It means
the
values
that are
stored in
a
collectio
n is
based
on the
values
that are
added to
the
collectio
n. So we
can
iterate
the
values
from the
collectio
n in a
specific
Collection order.
List
Set Sorted:
Map
Sorting
mechani
sm can
be
applied
internally
or
externall
y so that
the
group of
objects
sorted in
a
particula
r
collectio
n is
based
on
propertie
s of the
Sorted Set objects.
Sorted Map
Queue
Classes:
Lists:
Array List
Vector
Linked List
Sets:
Hash set
Linked Hash Set
Tree Set
Maps:
Hash Map
Hash Table
Tree Map
Linked Hashed Map
Queue:
Priority Queue