• 26 March

    Static block in java

    In this post, we will see about how to implement static block in java. Here are some important points about static block in java. Static block is used for static initializations of a class Static block is executed only once when either you create an object of the class or access static member of the […]

  • 24 March

    Initialize List of String in java

    In this post, we will see how to initialize List of String in java. Can you initialize List of String as below: [crayon-6a294ee3c7a84586769269/] You can't because List is an interface and it can not be instantiated with new List(). You need to instantiate it with the class that implements the List interface. Here are the […]

  • 23 March

    Get current timestamp in java

    In this post, we will see how to get current timestamp in java. There are multiple ways to get current timestamp in java. Using Java 8’s Instant class There are three ways to get timestamp using Java 8‘s java.time.Instant class. Using Instant.now() [crayon-6a294ee3c93ac470770531/] Using date.toInstant() [crayon-6a294ee3c93b3858560118/] Using timestamp.toInstant() [crayon-6a294ee3c93b5615060784/] Here is complete example for get […]

  • 23 March

    Why are Pokies Called Pokies: Deep Dive into Australian History Of Gambling

    Pokies, also called slot machines, are an integral part of the Australian casino landscape and have been round since the late 19th century. In recent times, pokies have become increasingly common throughout Australia, with over 200,000 machines operating in pubs, bars and clubs throughout the country. While their reputation has grown in leaps and bounds, […]

  • 22 March

    XOR operator in java

    In this tutorial, we will see about XOR operator in java. XOR operator or exclusive OR takes two boolean operands and returns true if two boolean operands are different. XOR operator can be used when both the boolean conditions can’t be true simultaneously. Here is truth table for XOR operator. Let’s say you have Person […]

  • 22 March

    [Fixed] insert dimensions to complete referencetype

    In this post, we will see about error insert dimensions to complete referencetype. You will get this error when you are trying to pass primitive objects into generic type declaration but generic always expect a Wrapper class in java. For example: Let’s say you have the below class named InsertDimensionlMain.java. [crayon-6a294ee3cbb9e938592814/] Above code won’t compile, […]

  • 21 March

    Java isNull method

    In this post, we will about Objects class’s isNull method. Objects’s isNull() method is used to check if object is null or not. java.util.Objects class was introduced in java 7. Here is simple example for Object's isNull method. [crayon-6a294ee3cc772468978497/] Output: Is str1 null: false Is str2 null: true Let’s look at source code Object’s isNull() […]

  • 17 March

    PriorityQueue in Java 8

    In this post, we will see about Java 8 PriorityQueue. When the objects are supposed to be processed on the basis of their priority, in that scenario we use PriorityQueue. It’s a special type of queue (also, unbound queues) where the elements can be ordered either as per their natural ordering or based on a […]

  • 17 March

    New line character in java

    In this post, we will see about new line character in java and how to add new line character to a String in different operating systems. Operating systems have different characters to denote the end of the line. Linux and new mac: In Linux, the end line is denoted by \n, also known as line […]