Very Important Java OOPS Interview Questions and Answers
Very Important Java OOPS Interview Questions and Answers
Answer:
Answer:
Some of the features which play important role in the popularity of java
are as follows:
e) Secured: Java is well known for its security. It delivers virus free
systems.
High Performance: Java enables high performance with the use of JIT
(Just-In-Time) compilers
Answer:
Answer:
Syntax:
Answer:
Syntax:
Answer:
Answer:
Local Variable:
Example:
Answer:
Answer:
Answer:
In picture below, Same Gentleman can take different roles like Father,
Employee, Shopper as per need etc.
Question: What are the types of Polymorphism?
Answer:
Answer:
Answer:
In this case, if we call the method with child class object, then the child
class method is called. To call the parent class method we have to use
super keyword.
Answer:
Abstraction In Java
Example: Mobile Phone.
Answer:
Syntax:
Points to remember:
Answer:
Answer:
An interface in Java looks similar to a class but both the interface and
class are two different concepts. An interface can have methods and
variables just like the class but the methods declared in interface are by
default abstract. We can achieve 100% abstraction and multiple
inheritance in Java with Interface.
Question: What is Encapsulation in Java?
Answer:
Second View:
Question: Write a program to print the pattern given below
12
123
1234
12345
Answer:
Answer:
Answer:
Second Approach:
Question: How To Find The Largest Value From The Given Array.
Answer:
Question: How to display all the prime numbers between 1 and 100
Answer:
Answer:
Answer:
Answer:
Method 1:
Method 2:
Answer:
Array:
Array is static
Size of the array should be given at the time of array declaration.
We cannot change the size of array after creating it
Array can contain both primitive data types as well as objects
Arrays are multidimensional
ArrayList:
ArrayList is dynamic
Size of the array may not be required. It changest the size
dynamically. Capacity of ArrayList increases automatically
whenever we add elements to an ArrayList
ArrayList cannot contain primitive data types. It contains only
objects
ArrayList is always single dimension
Answer:
ArrayList:
HashSet:
Answer:
Access modifiers are subdivided into four types such as Default, Public,
Private, Protected
Answer:
3. Java uses static binding for overloaded methods and dynamic binding
for overridden methods.
Answer:
ABSTRACT CLASS
INTERFACE:
Answer:
Answer:
Example:
#DEVELOPMENTINPROGRESS