• 27 March

    Understanding java.lang.reflect.InvocationTargetException and why it occurs

    In this post, we will see about java.lang.reflect.InvocationTargetException. You might get java.lang.reflect.InvocationTargetException while working with reflection in java. Reason for java.lang.reflect.InvocationTargetException Reflection layer throws this exception when calling method or constructor throws any exception. java.lang.reflect.InvocationTargetException wraps underlying exception thrown by actual method or constructor call. Let’s see this with the help of example: Create a […]

  • 26 March

    Global variables in java

    In this post, we will see how to define global variables in java. Unlike C/C++, there are no standard global variables in java but you can still define global variables that can be used across all classes. Global variables are those variables that can be accessed across all the classes. Java does not support global […]

  • 26 March

    [Fixed] no suitable driver found for jdbc

    In this post, we will see how to resolve java.sql.SQLException: No suitable driver found for JDBC. There can be multiple reasons for this exception and let’s see it one by one. connector jar is not on classpath you need make sure you have connector jar on classpath. For example: If you are using mysql to […]

  • 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-6a295a5e222cf708748676/] 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-6a295a5e228b4710515979/] Using date.toInstant() [crayon-6a295a5e228ba038825137/] Using timestamp.toInstant() [crayon-6a295a5e228bb868288110/] 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-6a295a5e23e71583423333/] Above code won’t compile, […]