HCL Technical Interview Questions

1) Does every class have a Constructor?

Yes, every class needs a Constructor. It may be Parameterized or Default. If the user does not define a constructor within a class, the default constructor is always included in that code.

The objective of Constructor is to initialize an object called object initialization. Constructors are mainly created for initializing an object.

2) How Java enable High Performance?

Java uses a Just-In-Time Compiler to enable high performance. Just-In-Time Compiler is a program that turns Java bytecode, which is a program that contains an instruction that must be interpreted into instruction that can be sent directly to the processor.

3) Why is java considered as dynamic?

It is designed to change the evolving environment. Java can carry an extensive amount of runtime information that can be used to verify and resolve access to the object at runtime.

4) What is joins in SQL?

Joins is nothing but connecting two or more table to fetch the record from two or more databases.

5) Can we have Private Constructor in Java?

Private Constructor is used if you do not want other class to instantiate the object. Private Constructor is used in Singleton design Pattern, Factory Method Design Pattern.

6) Differentiate Between Primary Key and Unique Key.

Primary Key Unique Key
1. In a Primary key, there should be only one primary key in a table. 1. In A Unique key, there can be more than one unique key in a table.
2. Primary key will block duplicate value and a null value. 2. Unique key will block duplicate value and accept a null value.

7) Differentiate between Method Overloading and Method Overriding.

Method Overloading Method Overriding
1. Method Overloading is used to gain the readability of the program. 1. Method Overriding is used to provide the specific implementation of the method that already provided by the superclass.
2. In the case of Method Overloading, the parameter must be different. 2. In the case of Method Overriding, the parameter must be equal.
3. Overloading happens at Compile time. 3. Overriding happens at runtime.
4. The Return type of method does not matter in case of method overloading it can be the same or different. 4. In the case of method Overriding, the return type must be the same.
5. you can overload a static, final and private method in Java 5. You cannot override a static, final and private method in Java.

8) What is the purpose of finalize () method in Java?

Finalize () method in java is a special method much like the main method in java. Finalize () method is called before garbage collector reclaims the object, its last chance for any object to perform clean up activity i.e. releasing any fixed order resources held, terminating connection if open etc.

9) Why can static method not override?

A static method cannot override because the static method is bound with class whereas instance method is bound with an object. Static method belongs to the class area and Instance method belong to the heap area.

10) What is singleton Class?

Singleton Class limited the number to one but allowing the flexibility to create more object if the situation changes.

11) Can we override java main method?

No, because main is a Static Method.

12) What is Class Cast Exception?

Class Cast Exception is thrown by java when you try to cast an object of one data type to another data type. Java allows us to cast the variable of one type to another as long as the casting happens between compatible data type.

13) Why polymorphism is used in Java?

The good reason for why polymorphism is a need in Java because the concept is extensively used in implementing inheritance. It plays an important role in allowing the object having a different internal structure to share the same external interface.

14) What is an Abstract class?

An Abstract class is one that is not used to create an object. It is only used as base class for the other class. The Abstract class is always public or friendly.


  1. public abstract class class_name
  2.         {
  3.             //class member
  4.         }

15) Can I have Private Constructor in Abstract Class?

Abstract Class can have Private Constructor But that class cannot be extended by another class. Alternatively, of adding a static inner class inside the Abstract Class and extends that Abstract Class.

Get Free Job Alerts on eMail !

Follow us on Telegram !

Campus Placement Guaranteed !

Follow us on Instagram !

Follow us on Facebook !

Follow us on LinkedIn !

Download Our APP !

Get Access To Our Premium Courses
Install our application from PlayStore and get discounts on our new courses.

Pin It on Pinterest