Java

Core Java Fundamentals Interview Questions

Basic Java concepts, JVM, JDK, JRE, data types, operators, and language fundamentals.

  • 20Questions with answers
  • 3Difficulty levels

Questions (20)

Browse beginner, intermediate, and advanced questions with answers — hide them when you want to self-test.

Question 1
Interview Beginner
Question

What are the main features of Java?

Answer:

Java provides platform independence, object-oriented programming, robustness, security, multithreading, distributed computing support, automatic memory management, and high performance through JIT compilation.

Question 2
Interview Beginner
Question

Why is Java platform independent?

Answer:

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

Question 3
Interview Beginner
Question

What is JVM?

Answer:

JVM (Java Virtual Machine) is a runtime environment that executes Java bytecode. It provides platform independence and manages memory, garbage collection, and execution.

Question 4
Interview Beginner
Question

What is JRE?

Answer:

JRE (Java Runtime Environment) contains the JVM and required libraries needed to run Java applications but does not include development tools.

Question 5
Interview Beginner
Question

What is JDK?

Answer:

JDK (Java Development Kit) includes JRE along with development tools such as javac, java, javadoc, and debugger utilities required to develop Java applications.

Question 6
Interview Beginner
Question

Explain the Java execution process.

Answer:

Java source code is compiled by javac into bytecode. The JVM loads the bytecode, verifies it, and executes it using the interpreter and JIT compiler.

Question 7
Interview Beginner
Question

What is the difference between Java and C++?

Answer:

Java is platform independent, supports automatic garbage collection, and does not support multiple inheritance through classes, whereas C++ is platform dependent and provides manual memory management.

Question 8
Interview Intermediate
Question

What are primitive data types in Java?

Answer:

Java has eight primitive data types: byte, short, int, long, float, double, char, and boolean.

Question 9
Interview Intermediate
Question

What is type casting?

Answer:

Type casting is the process of converting a value from one data type to another. It can be implicit or explicit.

Question 10
Interview Intermediate
Question

What is the difference between implicit and explicit casting?

Answer:

Implicit casting is performed automatically when converting a smaller type to a larger type, while explicit casting requires manual conversion from a larger type to a smaller type.

Question 11
Interview Intermediate
Question

What are operators in Java?

Answer:

Operators are symbols used to perform operations on variables and values. Examples include arithmetic, relational, logical, assignment, bitwise, and ternary operators.

Question 12
Interview Intermediate
Question

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

Answer:

The == operator compares object references, while equals() compares object content when properly overridden.

Question 13
Interview Intermediate
Question

What are command-line arguments?

Answer:

Command-line arguments are values passed to a Java program through the main method parameter String[] args during execution.

Question 14
Interview Intermediate
Question

What is Unicode in Java?

Answer:

Unicode is a universal character encoding standard used by Java to support internationalization and represent characters from multiple languages.

Question 15
Interview Advanced
Question

What is bytecode?

Answer:

Bytecode is the intermediate code generated by the Java compiler. It is platform independent and executed by the JVM.

Question 16
Interview Advanced
Question

Which Java language or JDK features are essential when discussing Core Java Fundamentals?

Answer:

Name concrete APIs (collections, concurrency, streams, annotations) tied to Core Java Fundamentals. Interviewers want syntax-level clarity plus when you would reach for each feature in production.

Question 17
Interview Advanced
Question

How does exception handling typically work around Core Java Fundamentals in Java?

Answer:

Prefer specific checked/unchecked exceptions, wrap lower-level failures with context, and avoid empty catch blocks. For Core Java Fundamentals, decide what is recoverable vs fatal to the request thread.

Question 18
Interview Advanced
Question

What unit-testing approach would you use for Core Java Fundamentals?

Answer:

JUnit 5 with Arrange-Act-Assert, Mockito for collaborators, and parameterized tests for edge cases. Keep Core Java Fundamentals logic pure where possible so tests stay fast.

Question 19
Interview Advanced
Question

How do equals/hashCode or identity rules affect Core Java Fundamentals?

Answer:

Incorrect equals/hashCode break HashMap/HashSet behavior. If Core Java Fundamentals stores objects in collections, explain the contract and mutability pitfalls.

Question 20
Interview Advanced
Question

What memory or GC concern should juniors watch with Core Java Fundamentals?

Answer:

Retain only needed references, prefer streaming for large datasets, and avoid accidental caches. Relate leaks or GC pressure to a concrete Core Java Fundamentals scenario.

Practice with AI mock interviews

Run Java mock interviews with AI follow-ups, instant feedback, and analytics on AiLx.

Free to start · No credit card required