0% found this document useful (0 votes)
2 views1 page

Core Java Interview Questions Professional Answers

The document provides a list of core Java interview questions covering fundamental concepts such as the definition of Java, its platform independence, and the differences between JDK, JRE, and JVM. It also discusses primitive data types, the distinction between == and equals(), the immutability of Strings, arrays, loop types, garbage collection, and memory management in stack versus heap. This serves as a foundational guide for understanding Java before delving into object-oriented programming.

Uploaded by

Nikhil Rathore
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)
2 views1 page

Core Java Interview Questions Professional Answers

The document provides a list of core Java interview questions covering fundamental concepts such as the definition of Java, its platform independence, and the differences between JDK, JRE, and JVM. It also discusses primitive data types, the distinction between == and equals(), the immutability of Strings, arrays, loop types, garbage collection, and memory management in stack versus heap. This serves as a foundational guide for understanding Java before delving into object-oriented programming.

Uploaded by

Nikhil Rathore
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

Core Java Interview Questions (Before OOPs)

1. What is Java?
Java is a high-level, object-oriented, and platform-independent programming language. It follows
the principle of Write Once, Run Anywhere because Java code is compiled into bytecode that runs
on the Java Virtual Machine (JVM).

2. Why is Java platform independent?


Java is platform independent because its source code is compiled into bytecode, which can run on
any system that has a compatible JVM installed.

3. Difference between JDK, JRE, and JVM?


JDK (Java Development Kit) is used for developing Java applications and includes development
tools. JRE (Java Runtime Environment) is used to run Java applications. JVM (Java Virtual
Machine) executes the bytecode.

4. What are primitive data types in Java?


Java has eight primitive data types: byte, short, int, long, float, double, char, and boolean. These
store simple values and are not objects.

5. Difference between == and equals()?


The == operator compares memory references, while equals() compares the actual content of
objects.

6. Why is String immutable in Java?


String is immutable to ensure security, better performance, and efficient memory utilization through
the String pool concept.

7. What is an array in Java?


An array is a collection of elements of the same data type stored in contiguous memory locations.

8. Difference between for loop and while loop?


A for loop is used when the number of iterations is known, while a while loop is used when the
iterations depend on a condition.

9. What is Garbage Collection?


Garbage Collection is an automatic memory management process that removes unused objects
from heap memory.

10. Difference between Stack and Heap memory?


Stack memory stores local variables and method calls, while heap memory stores objects and is
managed by the Garbage Collector.

You might also like