Java Concurrency – Basic Concepts

Defining and Starting a Thread There are two ways to define a thread: Provide a Runnable object or Subclass Thread. The first approach is more flexible and applicable to high-level thread concurrency APIs. It is also more general because the Runnable object can subclass a class other than Thread. Synchronization Synchronization can introduce thread contention, which occurs when two or more threads try […]

Senior Java Software Engineer Interview Notes – Part 3

Introduction These are the interview questions that were asked for the Software Engineer role in Bally’s Interactive. This post mentions Java, Design Patterns, REST, and Testing. Java What is immutability? An object is considered immutable if its state cannot change after it is constructed. They are helpful when writing secure code as you don’t need to worry […]

Senior Java Software Engineer Interview Notes – Part 2

Introduction This is the 2nd post regarding my interview experience for Senior Java Software Engineer roles in the UK. Note that these are NOT copy-paste interview questions that I found on the internet but the actual ones asked during interviews. Questions As a senior developer, you are basically expected to convert a problem statement into […]

Senior Java Software Engineer Interview Notes – Part 1

This is the 1st post regarding my interview experience for Senior Java Software Engineer roles in the UK. Note that these are NOT copy-paste interview questions that I found on the internet but the actual ones asked during interviews. Collections API Which data structure is used when you have lots of add and remote operations? […]

If/Else Cumleleri Icin Rule Tasarim Kalibi

Bugun, projemizde kullandigimiz Rule tasarim kalibi (Rule Design Pattern) anlatacagim. Bu yontemi zaman baskisi yuzunden ekibe kabul ettirmek zor oldu ama ortaya cikan sonuctan memnun kaldik. Umarim sizin de isinize yarar. Problem Spring Boot ile yazilan backend uygulamamizda farkli musteri tipleri icin farkli kurallarin uygulandigi bir fonksiyon vardi. Musteri tiplerine gore onyuze farkli bildirim mesajlarini […]

Java SE 8/11 Programmer II Exam Series: Concurrency (Part 1)

Introduction This post is currently in progress… In this post, we will look at the exam objective; create worker threads using Runnable, Callable, and use an ExecutorService to concurrently execute tasks. Note that this is also a part of the Java SE 11 Programmer II Certification. Runnable Interface Runnable interface Usages of Runnable interface Creating a […]

Java SE 8/11 Programmer II Exam Series: Internationalization and Localization

Introduction In this post, we will look at how to add internationalization and localization to the Java application. We will learn how to pick a locale, create and use properties files in different languages, and to format the numbers. Note that the localization is also a part of the Java SE 11 Programmer II Certification. […]

Item 42: Prefer lambdas to anonymous classes

Anonymous classes were adequate for the classic objected-oriented design patterns requiring function objects. Here’s a code snippet using an anonymous class. // Anonymous class instance as a function object – obsolete! Collections.sort(words, new Comparator<String>() { public int compare(String s1, String s2) { return Integer.compare(s1.length(), s2.length()); } }); Interfaces with a single abstract method are now […]

Item 15: Minimize the accessibility of classes and members

Encapsulation A well-designed component hides all its implementation details, cleanly separating its API from its implementation. Components then communicate only through their APIs and are oblivious to each others’ inner workings. This concept, known as information hiding or encapsulation, is a fundamental tenet of software design. The advantages of encapsulation are as follows: Speeds up […]

Class Initialization

Today, I will briefly mention about the class initialization. When we execute any java program (e.g.: java InitTest), Java Virtual Machine loads and link the class, execute initializers, and invokes the main class. Initialization process has some rules. Before we go into the details, spend a few minutes to figure out the output. class SuperClass { static { System.out.print(“0 […]