100 Java Tricky Interview Questions and Answers (Part 2)

51. Is it ok to use random numbers in the implementation of hashcode() method in Java? No. The hashcode of an object should be always same. If you use random number in hashcode() method, then you may get a different value of hashcode for same object. This will break the hashcode contract. 52. Between two … Read more100 Java Tricky Interview Questions and Answers (Part 2)

100 Java Tricky Interview Questions and Answers (Part 1)

1. Is there any difference between a = a + b and a += b expressions? When we add two integral variables e.g. variables of type byte, short, or int in Java, then they are first promoted to int type, and then addition happens. The += operator implicitly casts the result of addition into the … Read more100 Java Tricky Interview Questions and Answers (Part 1)

55 Java 8 Interview Questions and Answers

In this post Java 8 Interview Questions and Answers, we are going to explore some of the JDK8-related questions that might pop up during an interview. Java 8 is a platform release packed with new language features and library classes. Most of these new features are geared towards achieving cleaner and more compact code, and … Read more55 Java 8 Interview Questions and Answers

110 Java Multithreading Interview Questions and Answers (Part 3)

61. How can a synchronized block cause Thread starvation in Java? It is not defined for synchronization that which thread will enter a synchronized block. It may happen that if many threads are waiting for the entry to a synchronized block, some threads may have to wait longer than other threads. Hence these threads with … Read more110 Java Multithreading Interview Questions and Answers (Part 3)

Please share it if you found this useful
Hide Buttons