Posts

Java 8 Interview Questions

Q- What are the new features introduced in Java 8? Q- What are the characteristics of Java 8 lambda expressions? Q- Why lambda expression is to be sed? Q- What kind of variable you can access in the lambda expression? Q- What are the method references? Q- What are functional interfaces? Q- Explain the purpose of all different types of functional interfaces? Q- What are default methods? How to call them?  Q- What are static default methods? Hw to call them? Q- What is Streams in Java 8? Q- What is stream pipelining in Java 8? Q- How lambda expression and functional interfaces are related? Q- Can you create your own functional interface? Q- What is Optional? Why and How can you use it? Q- What is the difference between Predicate and Function?    Q- Prefer Lambdas to anonymous classes? Q- Prefer method references to lambdas?  Q- Use caution when making streams parallel? Q- Prefer Collection to Stream as a return type? Q- Prefer side-effect free functions in Streams?

Multi-Threading Questions

Q- Explain the Life cycle of a Thread? Q- You have Thread T1, T2, and T3. How will you ensure that Thread T2 is run after T1 and T3 run after T2? Q- What is the difference between wait() and sleep() in Java? Q- Write a program that will result in DeadLock.How will you fix DeadLock in Java? Q-  What is Thread Pool? How can we create Thread Pool in Java? Q- How to create Daemon Thread in Java? Q- What is ThreadGroup? Why it is advised not to use it? Q- What is the atomic operation? What are the atomic classes in Java Concurrency API? Q- In how many ways Threads can be created in Java? Q- Can we start a Thread twice? Q- Is there any relation between Threads like Parent-child? Q- How Exceptions are handles in case of MultiThreading scenario? Who will handle Exceptions if there is no handler? Q- What is the advantage of a new Lock interface over a synchronized block in Java? You need to implement a High-performance cache which allows multiple readers but a single writer to keep the integrit

Serialization and Deserialization Questions

Q- What is Serialization and Deserialization? Q- What is the purpose of java Serialization? Q- How to implement Serialization in Java? Q- How to make Java class Serializable? Q- What is the difference between Serializable and Externalizable in Java? Q- How many methods Serializable has? If no method then what is the purpose of the Serializable interface? Q- What is serialVersionUID? What would happen if you don't define this? Q- While serializing you want some of the members not to serialize, how do you achieve it? Q- Which methods are used during the Serialization and Deserialization process in Java? Q- What are the compatible changes and incompatible changes in the Java Serialization Mechanism? Q- Can we transfer a Serialized object via Network? Q- Which kind of variable is not serialized during Java Serialization? Q- How do we Serialize object, write a program to serialize and Deserialize object and persist it in a file? Q- Write a program to explain how we can Serialize and Des

Java Collections Framework Questions

Q- What is the Java Collections API? List down its advantages? Q- What are the advantages of the Collection Framework in Java? Q- Describe the Collection hierarchy in Java? Q- What is the ConcurrentHashMap in Java and do you implement it? Q- Can you use any class as a Map key? Q- Why Map doesn’t extend the Collection Interface? Q- List down the different Collection views provided by the Map interface in the Java Collection framework? Q- When to use ArrayList and LinkedList? Q- What is the advantage of using the Properties file? Q- What are the various interfaces used in the Collections Framework? Q- What do you understand by BlockingQueue? Q- What is the advantage of the Generic Collection? Q- What do you understand by Fail-Fast and Fail-Safe? Q- What do you understand by the Iterator in Java Collection Framework? Q- What is the hash-collision in Hashtable and How it is handled? Q- What is the Dictionary class? Q- What is the default size of load factor in hashing based collection? Q-