Top 10 OCAJP and OCPJP Exam Simulators and Practice Test for Java Certifications

There is no doubt that exam simulators play an essential role in preparing for any Java certification like OCAJP, OCPJP, OCEJWCD, OCMJEA exams. In fact, they are one of the most crucial pillars because choosing a good exam simulator with a good book is generally the success mantra of many Java certification aspirants. The exam simulators prepare you well for exams by presenting the level of questions you can expect in real exams. They provide the much-needed practice in the exam like environment to increase your speed and accuracy required to pass a time-bound exam like OCAJP and OCPJP. It also helps you to find out your strong and weak areas well before the exam, so that you can focus more on weak areas.

How to sort ArrayList in java - List Sorting - Ascending Descending Order

How to sort ArrayList ascending descending order 
Sorting ArrayList in Java is not difficult, by using Collections.sort() method you can sort ArrayList in ascending and descending order in Java. Collections.sort() the method optionally accepts a Comparator and if provided it uses Comparator's compare method to compare Objects stored in Collection to compare with each other, in case of no explicit Comparator, Comparable interface's compareTo() method is used to compare objects from each other. If objects stored in ArrayList don't implement Comparable then they can not be sorted using Collections.sort() the method in Java.

What is difference between wait and sleep in Java Thread?

Wait vs sleep in Java
Differences between wait and sleep method in Java multi-threading is one of the very old questions asked in Java interviews. Though both wait and sleep put thread on waiting state, they are completely different in terms of behavior and use cases. Thread.sleep(long millis) is meant for introducing pause, releasing CPU and giving another thread an opportunity to execute while wait is used for inter thread communication in Java. These methods are defined in java.lang.Object class and available to every object in Java. It is based upon object lock, if you remember every object in Java has implicit lock, also known as monitor.