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

Java_Viva_Questions_Answers

The document contains a series of Java viva questions and answers categorized into basic, intermediate, and advanced levels. Key topics include Java fundamentals, inheritance, method overloading, interfaces, exception handling, multithreading, and collections. It also distinguishes between JDK and JRE, explaining their roles in Java development and execution.

Uploaded by

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

Java_Viva_Questions_Answers

The document contains a series of Java viva questions and answers categorized into basic, intermediate, and advanced levels. Key topics include Java fundamentals, inheritance, method overloading, interfaces, exception handling, multithreading, and collections. It also distinguishes between JDK and JRE, explaining their roles in Java development and execution.

Uploaded by

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

Java Viva Questions and Answers

Basic Level

Q: What is Java?

A: Java is a high-level, object-oriented programming language developed by Sun Microsystems. It is

platform-independent due to the Java Virtual Machine (JVM).

Q: What is the difference between JDK, JRE, and JVM?

A: JDK is for development, includes JRE and compiler. JRE is for running Java apps. JVM interprets bytecode into

machine code.

Q: What are the features of Java?

A: Platform Independent, Object-Oriented, Secure, Robust, Multithreaded, High Performance.

Q: What is a Class and Object in Java?

A: Class is a blueprint; Object is an instance of the class.

Q: What are constructors in Java?

A: Special method to initialize objects, same name as class, no return type.

Intermediate Level

Q: What is inheritance?

A: One class inherits another class's properties using 'extends'.

Q: Types of inheritance in Java?

A: Single, Multilevel, Hierarchical (No multiple inheritance with classes).

Q: What is method overloading and overriding?

A: Overloading: same method, different parameters. Overriding: same method, subclass modifies behavior.

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

A: == compares references; .equals() compares values.


Java Viva Questions and Answers

Q: What are access modifiers?

A: private, default, protected, public - control visibility.

Advanced Level

Q: What is an interface?

A: A blueprint with abstract methods. Implemented using 'implements'.

Q: Difference between abstract class and interface?

A: Abstract class: mix of methods. Interface: abstract methods only (Java 8+ allows default/static).

Q: What is exception handling?

A: Using try, catch, finally, throw, throws to handle runtime errors.

Q: What is multithreading?

A: Allows multiple threads to run concurrently.

Q: Difference between ArrayList and LinkedList?

A: ArrayList: fast access. LinkedList: fast insertion/deletion.

Q: Use of final, finally, finalize()?

A: final: constant, finally: always runs, finalize(): called by GC before object removal.

Q: What is garbage collection in Java?

A: Automatic memory management to remove unused objects.

Q: What are lambdas in Java?

A: Concise way to implement functional interfaces. Syntax: (a, b) -> a + b

Q: What is Stream API?

A: Processes collections in a functional style: filter, map, reduce.


Java Viva Questions and Answers

Q: Difference between HashMap and TreeMap?

A: HashMap: unordered, fast. TreeMap: sorted, slower.

JDK vs JRE Role

Q: Which makes Java code run - JDK or JRE?

A: JDK compiles Java code using javac into bytecode (.class).

JRE runs the bytecode using JVM.

JDK = development (write+compile+run), JRE = runtime (only run).

You might also like