Threads in Java

We need to control access to shared state ( when multiple threads are at work ), to avoid unexpected results. In the case of the program below the shared state is the int sheepCount. 10 different threads call the method incrementAndReport() . Without thread management 

Output ( wonky ) Every thread is trying to … Read more

How Lambdas can be useful in Java

I’m revising for the OCP (Oracle Certified Professional Java Programmer ), and running over Lambdas at the moment. In tutorials I see many of them seem to focus on what they are , what they do , streams etc. Not much on how they can be used to improve code ( and making less Class … Read more

Installing ChromeDriver for WebDriver – For the Techies (Java)

If your using Webdriver to automate your web testing you’ll already know what a great tool it is. This is a quick note on installing ChromeDriver for WebDriver (to test using the Chrome Browser). 1. get the latest version of chrome driver from this url http://chromedriver.storage.googleapis.com/index.html 2. unzip this and place it whenever you want 3. … Read more

Java Generics (2008)

Notes on SCJP I did in 2008 Generics   Straight forward Type Safe Collections   List<Animal> myList = new ArrayList<Animal>();   the generic type in the declaration must match on both side of = , in this case <String> (unless a wildcard is used to the left of the equals OR the ref has no gen … Read more