KEMBAR78
OOPs Java Viva Questions | PDF | Method (Computer Programming) | Class (Computer Programming)
0% found this document useful (0 votes)
2 views4 pages

OOPs Java Viva Questions

The document provides a comprehensive overview of Java fundamentals and object-oriented programming concepts, including definitions of Java, JDK, JRE, and JVM. It covers key topics such as classes, objects, inheritance, encapsulation, abstraction, polymorphism, exception handling, and multithreading. Additionally, it explains the structure of Java source files, method overloading vs overriding, and the lifecycle of threads.

Uploaded by

Ravikant Choubey
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 views4 pages

OOPs Java Viva Questions

The document provides a comprehensive overview of Java fundamentals and object-oriented programming concepts, including definitions of Java, JDK, JRE, and JVM. It covers key topics such as classes, objects, inheritance, encapsulation, abstraction, polymorphism, exception handling, and multithreading. Additionally, it explains the structure of Java source files, method overloading vs overriding, and the lifecycle of threads.

Uploaded by

Ravikant Choubey
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
You are on page 1/ 4

OOPs with Java - Viva Questions & Answers (Up to Multithreading)

UNIT I: Java Fundamentals & OOP Concepts

1. What is Java?

Java is a high-level, class-based, object-oriented programming language developed by James

Gosling at Sun Microsystems in 1995.

2. Difference between JDK, JRE, and JVM?

JVM: Executes Java bytecode.

JRE: JVM + Libraries to run Java applications.

JDK: JRE + development tools like javac.

3. Java Source File Structure:

Includes optional package declaration, imports, class declaration, and the main method.

4. Class and Object:

Class is a blueprint; object is an instance.

5. Constructor:

Special method to initialize objects. No return type. Invoked during object creation.

6. Access Specifiers:

public, private, protected, and default (package-private).

7. Method Overloading vs Overriding:

Overloading: Same method name, different parameters.


Overriding: Subclass modifies superclass method.

8. Inheritance:

Acquiring properties from parent class using 'extends'.

9. Encapsulation:

Data hiding using private variables with public getters/setters.

10. Abstraction:

Hiding internal details using abstract classes and interfaces.

11. Polymorphism:

Compile-time (overloading) and run-time (overriding) polymorphism.

12. Abstract Class vs Interface:

Abstract class can have implemented methods; interfaces define method signatures.

Packages

13. Package:

Collection of related classes/interfaces. Helps avoid conflicts.

14. Importing:

import java.util.Scanner;

15. Static Import:

Allows access to static members without class name.


Exception Handling

16. Exception:

Object representing runtime errors disrupting flow.

17. Types:

Checked (IOException) and Unchecked (ArithmeticException).

18. try-catch-finally:

Blocks used to handle exceptions and cleanup.

19. throw vs throws:

throw - to explicitly throw an exception.

throws - declares exceptions a method might throw.

Input/Output

20. Byte vs Character Streams:

Byte - binary data (FileInputStream); Character - text data (FileReader).

21. File I/O:

FileReader/Writer and BufferedReader/Writer used for text file handling.

Multithreading

22. Multithreading:
Concurrent execution of threads, improving efficiency.

23. Thread:

Smallest unit of process that runs concurrently.

24. Creating Threads:

Extending Thread class or implementing Runnable.

25. Thread Lifecycle:

New, Runnable, Running, Blocked/Waiting, Terminated.

26. Thread Priorities:

Range from 1 to 10. Default is 5.

27. Synchronization:

Controlling access to shared resources to avoid conflicts.

28. Inter-thread Communication:

Using wait(), notify(), notifyAll() for coordination between threads.

You might also like