Page Nav

HIDE

Grid

GRID_STYLE

Pages

30 viva quistions for java

  Here are some frequently asked Java interview questions: What is Java and its history? What are the features of Java? What is the differen...

 

Here are some frequently asked Java interview questions:

  1. What is Java and its history?
  2. What are the features of Java?
  3. What is the difference between Java and C++?
  4. What is the JVM and its architecture?
  5. What is the difference between JDK, JRE, and JVM?
  6. What are the data types in Java?
  7. What are the different control structures in Java?
  8. What is inheritance in Java?
  9. What is polymorphism in Java?
  10. What is encapsulation in Java?
  11. What is an abstract class and an interface in Java?
  12. What is the use of the ‘final’ keyword in Java?
  13. What is the difference between an inner class and a nested class in Java?
  14. What is the use of the ‘static’ keyword in Java?
  15. What is the use of ‘this’ keyword in Java?
  16. What is a constructor in Java?
  17. What is the use of ‘super’ keyword in Java?
  18. What is an exception in Java?
  19. How do you handle exceptions in Java?
  20. What is a collection in Java?
  21. What is the difference between ArrayList and LinkedList in Java?
  22. What is a Map in Java?
  23. What is a Set in Java?
  24. What is the use of Java Generics?
  25. What is the difference between Array and ArrayList in Java?
  26. What is a Java Thread?
  27. What is the difference between a process and a thread in Java?
  28. What is a synchronization in Java?
  29. What is the difference between ‘wait’ and ‘sleep’ in Java?
  30. What is a Java Package?

here are brief answers to the above Java interview questions:

  1. Java is a high-level programming language developed by Sun Microsystems and is widely used for developing enterprise-level applications.
  2. Features of Java include object-oriented programming, platform independence, automatic memory management, and secure.
  3. Java is an object-oriented language while C++ is a hybrid language supporting both procedural and object-oriented programming.
  4. JVM (Java Virtual Machine) is an abstract computing machine responsible for executing Java code.
  5. JDK (Java Development Kit) contains tools for developing Java applications, JRE (Java Runtime Environment) contains libraries to run Java applications, and JVM is the component that executes Java applications.
  6. Data types in Java include primitive types (e.g. int, float), reference types (e.g. objects, arrays), and wrapper classes.
  7. Control structures in Java include if-else, switch, for loop, while loop, and do-while loop.
  8. Inheritance in Java is the mechanism of obtaining the properties and behaviors of one class by another class.
  9. Polymorphism in Java is the ability of an object to take on many forms.
  10. Encapsulation in Java is the mechanism of wrapping data and functions within a single unit (object) to protect it from outside interference.
  11. An abstract class in Java is a class that cannot be instantiated and is meant to be subclassed, while an interface is a blueprint of methods to be implemented by the classes.
  12. The ‘final’ keyword in Java is used to make a variable or method constant and non-overridable.
  13. An inner class is a class defined within another class, while a nested class is a static class defined within another class.
  14. The ‘static’ keyword in Java is used to make a member of a class shared among all instances of the class.
  15. The ‘this’ keyword in Java is used to refer to the current object.
  16. A constructor in Java is a special method used to initialize an object.
  17. The ‘super’ keyword in Java is used to access the members of the superclass.
  18. An exception in Java is an abnormal event that disrupts the normal flow of the program.
  19. Exceptions in Java can be handled using try-catch blocks.
  20. A collection in Java is an object that groups multiple elements into a single unit.
  21. ArrayList and LinkedList are both implementations of the List interface in Java, with ArrayList being more efficient for random access and LinkedList being more efficient for inserting and deleting elements in the middle.
  22. A Map in Java is an object that maps keys to values.
  23. A Set in Java is a collection that cannot contain duplicate elements.
  24. Java Generics allow for type-safe and generic programming in Java.
  25. An Array in Java is a fixed-sized data structure while an ArrayList is a dynamic-sized array implementation.
  26. A Java Thread is a separate execution path within a Java program.
  27. A process is an instance of a program while a thread is a smallest unit of processing within a process.
  28. Synchronization in Java is used to control access to shared resources by multiple threads.
  29. The ‘wait’ method in Java releases a lock and waits for another thread to complete, while the ‘sleep’ method only pauses the current thread for a specified amount of time.
  30. A Java Package is a mechanism for organizing Java classes into namespaces.

No comments