0% found this document useful (0 votes)
5 views

Java (1)

Uploaded by

rockyrajs2210
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Java (1)

Uploaded by

rockyrajs2210
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

# Abstraction - Abstraction is a process which displays only the information needed

and hides the unnecessary information. We can say that the main purpose of
abstraction is data hiding.
example - Like we send msg
# Encaplusation - is use to Binding (or wrapping) code and data together into a
single unit is known as encapsulation.
Example - Capsule
# Coupling in Java
Coupling refers to the relationship between two classes. It indicates the knowledge
one object or class has of another. That means that if one class changes its
properties or behaviour, it will affect the dependent changes in the other class.
Therefore, these changes will depend upon the level of interdependence the two
classes have between them. There are two types of coupling, namely tight coupling,
and loose coupling.
# Inheritance - When one object acquires all the properties and behaviours of
parent object i.e. known as inheritance. It provides code reusability. It is used
to achieve runtime polymorphism.
There are five types of inheritance single, multilevel, multiple, hybrid and
hierarchical.
Example - Scarpio -> car -> Tyre
# Polymorphism - Polymorphism refers to many forms, or it is a process that
performs a single action in different ways. It occurs when we have many classes
related to each other by inheritance.
Example - Person same time Father, Brother, Employee, Husband, Uncle.
# What is Compile-Time Polymorphism in Java?
Compile-Time polymorphism in java is also known as Static Polymorphism. to resolved
at compile-time which is achieved through the Method Overloading.

# What is Runtime Polymorphism in Java?


Runtime polymorphism in java is also known as Dynamic Binding which is used to call
an overridden method that is resolved dynamically at runtime rather than at compile
time.
# Static Method in Java - A method that belongs to a class rather than an instance
of a class is known as a static method.
# Abstract Method in Java
A method that is declared with keyword abstract is called an abstract method. The
abstract method does not have an implementation or body, or block of code.
# Final Method in Java
A method that is declared final is called a final method. We cannot override a
final method. This means the child class can still call the final method of the
parent class without any problem, but it cannot override it. This is because the
main purpose of making a method final is to stop the modification of the method by
the sub-class.

# Why Java is not 100 object-oriented Interview Questions?


Java is not considered a pure object-oriented programming language due to the
presence of primitive data types and the inclusion of static variables and methods
that can be accessed without objects.
# Why String class is immutable or final in Java? - The string is immutable means
that we cannot change the object itself, but we can change the reference to the
object. The string is made final to not allow others to extend it and destroy its
immutability.And Because of Security, Synchronization and Concurrency, caching,
class Loading.

You might also like