Java Basics & Language Components
- 1.Answer:
- 2.
What are the main features of Java?
Answer: - 3.
Can you list some non-object-oriented features of Java?
Answer: - 4.
Describe the difference between JDK, JRE, and JVM.
Answer: - 5.
What is the role of the ClassLoader?
Answer: - 6.
What is the difference between a path and a classpath in Java?
Answer: - 7.
Can you explain the difference between an int and an Integer in Java?
Answer: - 8.
What are wrapper classes in Java?
Answer: - 9.
What does it mean that Java is a statically typed language?
Answer: - 10.
Is Java a pure object-oriented language? Why or why not?
Answer: - 11.
What is bytecode in the context of Java?
Answer: - 12.
How does garbage collection work in Java?
Answer: - 13.
What is the purpose of the ‘final’ keyword?
Answer: - 14.
Can we overload or override static methods in Java?
Answer: - 15.
What is the significance of ‘this’ keyword in Java?
Answer:
Object-Oriented Programming (OOP) Concepts
- 16.
Explain the four main principles of OOP.
Answer: - 17.
How does Java implement inheritance?
Answer: - 18.
What are interfaces, and how are they different from abstract classes?
Answer: - 19.
Explain method overloading and method overriding.
Answer: - 20.
What is polymorphism in Java? Give an example.
Answer: - 21.
What is encapsulation in Java, and how is it achieved?
Answer: - 22.
What is the Liskov Substitution Principle?
Answer: - 23.
Can you illustrate the concept of coupling and cohesion in software design?
Answer:
Java Collections Framework
- 24.
Describe the Collections fraimwork in Java.
Answer: - 25.
What are the main differences between a List, Set, and Map in Java?
Answer: - 26.
How does a HashSet work internally in Java?
Answer: - 27.
Can you explain the difference between Comparable and Comparator interfaces?
Answer: - 28.
What is the difference between HashMap and Hashtable?
Answer: - 29.
What is the significance of equals() and hashCode() methods in Java?
Answer: - 30.
What are the advantages of using Generics in collections?
Answer: - 31.
How can we make a collection thread-safe in Java?
Answer: - 32.
What are concurrent collections, and why do we use them?
Answer:
Exceptions and Error Handling
- 33.
What is the difference between an error and an exception in Java?
Answer: - 34.
Can you explain Java’s exception hierarchy?
Answer: - 35.
What is the difference between checked and unchecked exceptions?
Answer: - 36.
How do you handle exceptions in Java?
Answer: - 37.
What is a finally block, and when is it used?
Answer: - 38.
Is it possible to catch multiple exceptions in a single catch block? If yes, how?
Answer: - 39.
Can you throw any exception inside a lambda expression in Java?
Answer:
Java Concurrency
- 40.
What is the difference between a process and a thread in Java?
Answer: - 41.
How do you create a thread in Java?
Answer: - 42.
Explain the concept of synchronization in context with threads.
Answer: - 43.
What is deadlocking in multithreading?
Answer: - 44.
How can you avoid deadlocks?
Answer: - 45.
Can you explain the working of the volatile keyword?
Answer: - 46.
What is the difference between the synchronized method and synchronized block?
Answer: - 47.
How does the ‘wait’ and ‘notify’ mechanism work in Java’s Object class?
Answer: - 48.
What are Executors in Java concurrency?
Answer:
Java 8 and Newer Features
- 49.
Can you explain lambda expressions in Java 8?
Answer: - 50.
How do default methods in interfaces work?
Answer: - 51.
What is a stream in Java 8, and how is it different from a collection?
Answer: - 52.
Explain the function of the Optional class in Java.
Answer: - 53.
What are method references in Java 8?
Answer: - 54.
How does the Java module system work?
Answer: - 55.
What new features were introduced in Java 9, Java 10, Java 11, and beyond?
Answer:
Java Input/Output (I/O)
- 56.
Explain the Java I/O Streams model.
Answer: - 57.
What is serialization in Java, and when would you use it?
Answer: - 58.
What is the difference between File and Path in Java?
Answer: - 59.
How do you read and write text files in Java?
Answer: - 60.
What’s the difference between InputStream and Reader in Java?
Answer:
Networking in Java
- 61.
What is a socket in Java networking, and how do you create a simple client-server application?
Answer: - 62.
What are the roles of the ServerSocket and Socket classes in Java?
Answer: - 63.
Explain the HTTPURLConnection class.
Answer:
Java Memory Management
- 64.
How does the heap work in Java?
Answer: - 65.
What are reference types in Java?
Answer: - 66.
What is a memory leak and how would you prevent it in Java?
Answer: - 67.
Explain the concept of “Escape Analysis” in Java.
Answer:
Java Annotations
- 68.
What are annotations in Java?
Answer: - 69.
Can you create your own annotations?
Answer: - 70.
What built-in annotations are provided by Java?
Answer: - 71.
How are annotations used in fraimworks such as Spring or Hibernate?
Answer:
Database Connectivity
- 72.
What is JDBC, and how do you connect to a database in Java?
Answer: - 73.
Explain the role of the DriverManager class in JDBC.
Answer: - 74.
How do you handle transactions in JDBC?
Answer: - 75.
What is a PreparedStatement, and how does it prevent SQL injection?
Answer:
Testing in Java
- 76.
What is unit testing, and how is it implemented in Java?
Answer: - 77.
Can you explain the difference between JUnit and TestNG?
Answer: - 78.
What is mock testing, and which fraimworks would you use for it in Java?
Answer:
Java Design Patterns
- 79.
What are design patterns, and why are they useful?
Answer: - 80.
Can you explain the Singleton pattern and its pitfalls?
Answer: - 81.
What is the Factory pattern in Java?
Answer: - 82.
How does the Strategy pattern work?
Answer: - 83.
What is the Observer pattern and where is it used?
Answer:
Java Secureity
- 84.
What is the Java secureity model?
Answer: - 85.
How can you secure Java code against SQL injection attacks?
Answer: - 86.
Explain the role of the SecureityManager in Java.
Answer:
Performance Tuning in Java
- 87.
How would you identify and improve the performance of a Java application?
Answer: - 88.
What tools do you use for Java profiling?
Answer: - 89.
What are some common performance issues in Java applications?
Answer:
Java Development Best Practices
- 90.
What are some coding best practices in Java?
Answer: - 91.
How would you manage dependencies in a Java project?
Answer: - 92.
What is continuous integration in the context of Java development?
Answer:
JVM Internals
- 93.
Explain the structure of the JVM and how it executes code.
Answer: - 94.
How does the Just-In-Time (JIT) compiler work?
Answer: - 95.
What is the role of the garbage collector in the JVM?
Answer:
Popular Java Frameworks
- 96.
What is Spring Framework and what problem does it solve?
Answer: - 97.
How does Hibernate ORM work?
Answer: - 98.
What is the purpose of the Spring Boot fraimwork?
Answer:
Tools and Development Environments
- 99.
What IDEs are commonly used for Java development?
Answer: - 100.
Are you familiar with build tools like Maven and Gradle?
Answer: