Wednesday, June 4, 2025

Top 23 Design Patterns Experienced Java Programmers Should Learn

Hello guys, if you want to learn Design Patterns and looking for a comprehensive tutorial which covers all important object oriented design pattern then you have come to the right place. Earlier, I have shared best Design pattern courses and books for experienced developers and in this article, I will introduce you with 23 common object oriented design patterns for writing better code. Design Patterns are tried and tested way of solving a problem within a given context. They are not invented, rather they are discovered, which is also obvious by use of word pattern. By using design pattern, you take knowledge of all wide communities and can safely use it to solve that problem. At times they might not give you perfect solution, require bit of tweaking, but they certainly provides one of the best solution, as long as you use them properly. While doing object oriented development, they are numerous task which appears quite often e.g. creating objects, structuring code, and implementing different behaviors based on different context.

Saturday, April 12, 2025

How to Reverse an Array in Java? Integer and String Array Example Tutorial

This Java tip is about, how to reverse an array in Java, mostly primitive types e.g. int, long, double and String arrays. Despite of Java’s rich Collection API, use of array is quite common, but standard JDK doesn’t have great utility classes for Java. It’s difficult to convert between Java Collection e.g. List, Set to primitive arrays. Java’s array utility class java.util.Arrays, though offers some the critical functionalities like comparing arrays in Java and support to print arrays, It lacks a lot of common features, such as combining two arrays and reverse primitive or object array. 

Wednesday, April 9, 2025

How to Format and Display Number to Currency in Java - Example Tutorial

Displaying financial amounts in the respective currency is a common requirement in Java-based E-commerce applications. For example, if you are selling products on-line globally, you will show price of products in their local currency rather than USD or some other currency. Storing price in every currency is not a good option because of maintenance, and more realistically fluctuation in exchange rates. That's why many of these applications prefer stores price of books, electronic goods, or whatever product they are selling in USD, and the responsibility of converting that price to local currency and displaying is left to client-side code. If your client is a Java-based client e.g. Swing GUI, Java FX client, or a JSP web page, you can use java.text.NumberFormat class to format currency in Java.