1.
user-defined exception in java
In java we can create our own exception class and throw that exception using throw
keyword. These exceptions are known as user-defined or custom exceptions.
2. Interface
An Interface is defined as an abstract type used to specify the behaviour of a class. An
interface in Java is a blueprint of a behaviour. A Java interface contains static constants and
abstract methods.
3. Abstract class
An abstract class in Java is a class declared with the abstract keyword. it is a restricted class
that cannot be used to create objects (to access it, it must be inherited from another class).
4. Inheritance
Inheritance is one of the key features of OOP that allows us to create a new class from an
existing class.
(i) Single Inheritance:
A subclass inherits from only one superclass. This is the simplest and most common form of
inheritance in Java.
Example:
class Dog extends Animal {
}
(ii) Multilevel Inheritance:
Involves a chain of inheritance where a class inherits from another class, and then another
class inherits from that subclass.
Example:
class BabyDog extends Dog {
}(//where Dog extends Animal
)
Hierarchical Inheritance:
Multiple subclasses inherit from a single superclass. All child classes share the properties
and methods of the same parent.
Example:
class Cat extends Animal {},
class Dog extends Animal {
}
5. Method Overriding
if the same method is defined in both the superclass and the subclass, then the method of the
subclass class overrides the method of the superclass. This is known as method overriding.
6. Polymorphism
Polymorphism is an important concept of object-oriented programming. It simply means
more than one form.
7. final keyword
The final keyword in Java is a non-access modifier used to prevent modification. It can be
applied to variables (value cannot change), methods (cannot be overridden) and classes
(cannot be extended).
8. super keyword
The super keyword in Java is used in subclasses to access superclass members (attributes,
constructors and methods).
9. Exception handling
Exception handling in Java is an effective mechanism for managing runtime errors to ensure
the application's regular flow is maintained. Some Common examples of exceptions include
ClassNotFoundException
10.Multithreading
Threads allows a program to operate more efficiently by doing multiple things at the same
time.
Threads can be used to perform complicated tasks in the background without interrupting the
main program.
11.Concurrency
Java concurrency refers to the ability to run multiple parts of a program, or multiple
programs, at the same time to improve performance and efficiency, especially on multi-core
processors
12.Thread.sleep()
In Java, Thread.sleep() is a static method used to pause the execution of the current thread
for a specified duration.
13.Java Constructors
A constructor in Java is a special method that is used to initialize objects.
The constructor is called when an object of a class is created.
Types of Constructor
In Java, constructors can be divided into three types:
I. No-Arg Constructor
II. Parameterized Constructor
III. Default Constructor
14.Constructor Overloading
Constructor overloading in Java allows a class to have multiple constructors with the same
name (which must be the class name) but different parameter lists.
15.what is vector
The Vector class is an implementation of the List interface that allows us to create resizable-
arrays similar to the ArrayList class.
Dynamic-size collection that can grow or shrink, implements the List interface.
16.what is Array?
Arrays are used to store multiple values in a single variable, instead of declaring separate
variables for each value.
To declare an array, define the variable type with square brackets [ ] :
Fixed-size collection of elements of the same data type.
17.Java Class
A class is a blueprint for the object. Before we create an object, we first need to define the
class.
18.Java Objects
An object is called an instance of a class.
19.The full form of HTTP is:
HyperText Transfer Protocol