java-shot Java Shot #4: Writing readable long numbers in Java If you are someone who works with Long numbers and BigIntegers, then you can make use of these two tricks to make these Long and BigIntegers more readable. Avoid using lower case l and use upper case L to represent a Long value. public class LongTest { public static void main(
java-shot Java Shot #3: Document Arrange, Act and Assert sections while writing Unit tests A unit test can be broken down into three segments. 1. Arrange 2. Act and 3. Assert In Arrange step, you would build the necessary data that is needed for execution of the test case along with that you can also setup Mock functionality. In the Act step, you will
java-shot Java Shot #2: Prefer using equality operator over equals() method for enums Enums are a powerful datatype in Java. There are many instances where you want to compare two enums. Given that a enum class supports equals() method, we end up using equals() method as it's frequently used for other object comparisons. In case of enums, using == (equality) operator is
java-shot Java Shot #1: The misapplication of equals() method in Java One of the major advantages of statically typed language is to identify invalid data type comparisons at compile time. Java is a statically typed language and that's one main reason why I like writing Java code but there are instances where it is not. Today I talk about