Turning Learners Into Developers
Codekilla
CODEKILLA
back to course
Lesson 80 / 80100%· free preview
Exam Prep2/2

Viva Questions

20 most-asked Java viva Q&A — short, exam-ready answers.

Common Java Viva Questions and Answers
  1. What is Java? Object-oriented, platform-independent, secure, multithreaded language by Sun Microsystems (now Oracle).
  2. What is bytecode? Intermediate code (.class) produced by javac and executed by the JVM.
  3. What is JVM? Java Virtual Machine — runs bytecode, manages memory, garbage collection.
  4. JDK vs JRE? JDK = JRE + dev tools (compiler, debugger). JRE only runs.
  5. What is OOP? Programming style based on objects (data + behaviour). 4 pillars: Inheritance, Encapsulation, Polymorphism, Abstraction.
  6. What is a class and an object? Class = blueprint; object = instance of a class.
  7. What is constructor? Special method with same name as class, no return type, called automatically when object is created.
  8. this vs super? this → current object; super → parent class.
  9. Method overloading vs overriding? Overloading: same method name, different params (compile-time). Overriding: subclass changes parent's method (run-time).
  10. Difference between final, finally, finalize? final keyword for constants; finally block always executes; finalize() called by GC before object is destroyed.
  11. What is exception handling? try / catch / finally / throw / throws — handle runtime errors gracefully.
  12. Checked vs unchecked exception? Checked: compile-time enforced (IOException). Unchecked: runtime (NullPointerException).
  13. What is a thread? Lightweight subprocess. Create via extends Thread or implements Runnable.
  14. String vs StringBuilder vs StringBuffer? String — immutable. StringBuilder — mutable, fast, NOT thread-safe. StringBuffer — mutable + thread-safe.
  15. What is collection framework? Set of interfaces & classes (List, Set, Map, Queue) for storing groups of objects.
  16. Why is Java not 100% OOP? Because it has primitive types (int, char, double) — not objects.
  17. What is package? Group of related classes — gives namespace + access protection.
  18. What is JDBC? Java DataBase Connectivity API — connects Java code to databases.
  19. What is static keyword? Belongs to the class, not any instance — shared across all objects.
  20. Is Java pass-by-value or pass-by-reference? Always pass-by-value (but for objects, the value is a reference copy).
AI-powered recap

Quick recap quiz?

We'll generate 5 MCQs from this lesson and check your understanding instantly. Takes ~30 seconds.

Ready to move on?
// example library
Want more hands-on snippets in Java?
Browse 100 runnable examples · across 10 chapters · short, copy-paste-friendly · grouped by topic
Explore examples
// side-by-side reference
See this in other languages
Compare the same concept across C, C++, Java, and Python — one table, zero tab-switching.
Compare Languages
// feedback.matters()
Did this lesson help you?