0% found this document useful (0 votes)
6 views3 pages

Java Collection Framework and Java Interview Notes HCL

The document provides a list of Java basic and OOP interview questions specifically for HCL fresher candidates with a salary of 3.25 LPA. It covers key Java features, differences between JDK, JRE, and JVM, OOP principles, and sample coding questions. Additionally, it includes HR and project-related questions to assess the candidate's experience and motivation for joining HCL.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

Java Collection Framework and Java Interview Notes HCL

The document provides a list of Java basic and OOP interview questions specifically for HCL fresher candidates with a salary of 3.25 LPA. It covers key Java features, differences between JDK, JRE, and JVM, OOP principles, and sample coding questions. Additionally, it includes HR and project-related questions to assess the candidate's experience and motivation for joining HCL.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Java Basic & OOP Interview Questions (For HCL Fresher – 3.

25 LPA)

1. What are the main features of Java?


Object-oriented, platform-independent, simple, secure, robust, multithreaded, portable.

2. Difference between JDK, JRE, and JVM?


JDK = Development kit, JRE = Runtime environment, JVM = Executes bytecode.

3. What are the 4 OOP principles?


Encapsulation, Inheritance, Polymorphism, Abstraction.

4. Difference between method overloading and overriding?


Overloading: compile-time, same name diff params. Overriding: runtime, same name & params in
subclass.

5. What is the difference between == and .equals()?


== compares memory address, .equals() compares content.

6. What is a constructor?
Special method used to initialize objects; same name as class; no return type.

7. Can we overload constructors?


Yes, by changing number/type of parameters.

8. Difference between String, StringBuilder, and StringBuffer?


String = immutable; StringBuilder = mutable, non-thread-safe; StringBuffer = mutable, thread-safe.

9. What is the use of static keyword?


Belongs to class, not object. Used for shared methods/variables.

10. What is final, finally, and finalize()?


final = constant/non-overridable; finally = always executes; finalize() = called before GC.

Sample Java Coding Questions:


• Check if number is even or odd
Scanner sc = new Scanner([Link]);
int n = [Link]();
if(n%2==0) [Link]("Even"); else [Link]("Odd");

• Reverse a string
String s = "Java";
String rev = new StringBuilder(s).reverse().toString();
[Link](rev);

• Find factorial using recursion


int fact(int n){ if(n==0) return 1; else return n*fact(n-1); }

HR & Project-related Questions in HCL:


1 Tell me about your Java project (your role, tools used).
2 Which data structures did you use in your project?
3 Explain any bug or error you solved in your project.

4 How do you handle errors using try-catch?

5 What was the most challenging part of your project?

6 Which IDE and tools do you prefer for coding?

7 Why do you want to join HCL?

8 Are you ready to relocate?

You might also like