• Get current year in java
    13 July

    Get current year in Java

    In this post, we will see how to get current year in Java. Using Date and SimpleDateFormat The Date class was introduced in Java 1.0 and provided different approaches to work with time. The SimpleDateFormat inherits from DateFormat and is mainly used to parse a date to text. You can provide your custom pattern to […]

  • 13 July

    Remove substring from String in Java

    In this post, we will see how to remove substring from String in java. There are multiple ways to remove substring from String in java. Using String’s replace method to remove substring from String in Java This method belongs to the Java String class and is overloaded to provide two different implementations of the same […]

  • Print HashMap in java
    30 June

    Print HashMap in Java

    In this article, we will see how to print HashMap in java using different method. Print from the HashMap Reference This is the most basic and easiest method to print out HashMap in java. Pass the HashMap reference to the System.out.println, and the HashMap will output the key-value of the elements enclosed in curly brackets. […]

  • Print LinkedList in java
    26 June

    Print LinkedList in java

    Java inbuilt LinkedList Java inbuilt LinkedList class uses doubly linked list as internal data structure to store its elements. It is subclass of AbstractList and implements List and Deque interfaces. Insertion and deletion of elements is faster than ArrayList as it interally uses double LinkedList. Print LinkedList using a for loop The most common method […]

  • Java String contains IgnoreCase
    23 June

    Java String contains Ignore Case

    We often have to check if a string contains a substring or not in a case-insensitive manner. There are multiple ways to do so. In this article, we will take a look at these methods for java String contains Ignore Case checks. Next, we will look at each method in detail. Using String.toLowerCase() One of […]

  • public static void main(String args[]) - Java main method
    11 June

    public static void main(String[] args) – Java main method

    If you have worked with Java programs before, you know that all Java programs start by running the main() method(public static void main(String[] args)). The main() method is the entry point. The signature of the main method is fixed, and each portion of the statement has significance. Why is the main method so important? The […]

  • Find and count occurences of substring in String in Java
    02 June

    Find and count occurrences of substring in string in java

    In this post, we will see how to find and count occurrences of substring in string in java. Using the indexOf() method The indexOf() method in java is a specialized function to find the index of the first occurrence of a substring in a string. This method has 4 overloads. [crayon-673fc4c70412c413696797/] We will use the […]

  • Print double quotes in java
    23 May

    Print double quotes in java

    💡 Outline You can print double quotes in java by escape double quotes using backslash character(\). [crayon-673fc4c7045b0759812912/] When you print on console using System.out.println, you use double quotes and whatever value inside double quotes is printed. But what if you want to actually print double quotes on console. In this tutorial, we will see different […]

  • Question mark in java
    20 May

    Question mark operator in java

    Learn about Question mark operator in java. It is also know as ternary operator.