0% found this document useful (0 votes)
6 views

Java Core Interview Question

Uploaded by

Prasanta Agasti
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Java Core Interview Question

Uploaded by

Prasanta Agasti
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Top 10 Java Core Interview Question

DESIGNED BY ASHISH PRATAP SINGH


What are the key features of Java?

● Platform independent
● OOP, multithreading
● Robust
● Exception handling,
● Multithreaded
● Distributed
● Dynamic

DESIGNED BY ASHISH PRATAP SINGH


Explain the difference between JDK, JRE, and JVM

● JDK is For development

● JRE: To run Java programs

● JVM: Executes bytecode

Check out my Post – Click Here

DESIGNED BY ASHISH PRATAP SINGH


What is the difference between == and .equals()?
● ==: Compares memory references

● .equals(): Compares object values

Ex– String s1 = new String("Java"); String s2 = new String("Java");

// == compares memory references (false because s1 and s2 are different objects)

System.out.println(s1 == s2); // Output: false

// .equals() compares object values (true because both have the same content)

System.out.println(s1.equals(s2)); // Output: true

DESIGNED BY ASHISH PRATAP SINGH


What is the significance of the final keyword?

● final variables: Constants

● final methods: Prevent overriding

● final classes: Prevent inheritance

DESIGNED BY ASHISH PRATAP SINGH


Explain method overloading vs. method overriding

● Overloading: Same method name, different parameters.

● Overriding: Same method name, same parameters, but different


implementation in a subclass.

DESIGNED BY ASHISH PRATAP SINGH


What is a thread in Java, and how is it created?

● A thread is the smallest unit of execution. We can create via:-

i) Extending Thread
ii) Implementing Runnable

DESIGNED BY ASHISH PRATAP SINGH


What are access modifiers in Java?

● public, private, protected, and default. They define the visibility of classes,
methods, and variables.

DESIGNED BY ASHISH PRATAP SINGH


Explain the concept of garbage collection in Java.

● JVM automatically deallocates unused objects to free up memory.

● Developers can suggest using System.gc().

Want to Deep Dive- Click Here

DESIGNED BY ASHISH PRATAP SINGH


What is the difference between ArrayList and
LinkedList?

● ArrayList: Better for random access.

● LinkedList: Better for frequent insertions/deletions.

DESIGNED BY ASHISH PRATAP SINGH


What is the difference between String, StringBuffer,
and StringBuilder?
● String: Immutable.

● StringBuffer: Mutable, thread-safe.

● StringBuilder: Mutable, non-thread-safe.

DESIGNED BY ASHISH PRATAP SINGH


THANK YOU
All
Follow me on
Ashish Pratap Singh

DESIGNED BY ASHISH PRATAP SINGH

You might also like