• 16 September

    JUnit assertEquals example

    Junit 5’s org.junit.jupiter.Assertions class provides different static assertions method to write test cases. Please note that you need to use JUnit’s org.junit.Assert class in case of JUnit 4 or JUnit 3 to assert using assertEquals method. assertEquals usage Assertions.assertEquals() checks if expected and actual are equal. In case, both are not equal, it will through […]

  • 15 September

    What are Xmx and Xms parameters in java

    In this post, we will see about Xms and Xmx parameter in java. -Xmx specifies maximum memory size for Java virtual machine (JVM), while -Xms specifies the initial memory size. It means JVM will be started with Xms amount of memory and JVM will be able to use maximum of JVM amount of memory. Let’s […]

  • 11 September

    Junit assertNotNull example

    Junit 5’s org.junit.jupiter.Assertions class provides different static assertions method to write test cases. Please note that you need to use JUnit’s org.junit.Assert class in case of JUnit 4 or JUnit 3 to assert using assertNotNull method. Assertions.assertNotNull() checks if object is not null. In case, object is null, it will through AssertError. public static void […]

  • 11 September

    JUnit assertNull example

    Junit 5’s org.junit.jupiter.Assertions class provides different static assertions method to write test cases. Please note that you need to use JUnit’s org.junit.Assert class in case of JUnit 4 or JUnit 3 to assert using assertNull method. Assertions.assertNull() checks that object is null. In case, object is not null, it will through AssertError. public static void […]

  • 10 September

    JUnit assertNotSame example

    Junit 5’s org.junit.jupiter.Assertions class provides different static assertions method to write test cases. Please note that you need to use JUnit’s org.junit.Assert class in case of JUnit 4 or JUnit 3 to assert using assertNull method. Assertions.assertNotSame() checks whether expected and actual object refer to different objects. In case, both refer to same object, it […]

  • 25 July

    Validate phone number in java

    In this post, we will see how to validate phone number in java. Validate any international phone number as per E.123 E.123 is a standards-based recommendation by the International Telecommunications Union sector ITU-T. E.123 provides following specifications. The leading plus (+) serves as an international prefix symbol, and is immediately followed by the country code […]

  • 16 July

    Garbage Collection in java

    In this post, we will see about Garbage Collection in java. I will try to explain with the help of diagrams and examples rather than theory. JVM Memory is divided into three parts Young generation Old generation Metaspace (Perm Gen) Young Generation As the name suggests, young generation is the area where newly created objects […]

  • 11 July

    Validate email address in java

    In this post, we will see how to validate email address in java. There are times when you have to validate email address provided by user. You might want to write your own logic to validate email addresses but there are lots of standard regular expressions or libraries which can help you validate email address […]

  • 29 May

    How to print even and odd numbers using threads in java

    In this post, we will see how to print even and odd numbers using threads in java. see also: How to print sequence using 3 threads in java Problem You are given two threads. You need to print odd numbers using one thread and even numbers using another thread.You need to print in natural order […]