• 07 December

    How to set java path in windows 10

    In this post, we will see about how to set java path in windows 10 using cmd. To set java path, you need to first understand about JAVA_HOME and how to set JAVA_HOME in windows 10. Let’s first understand about JAVA_HOME and then we will see how to set JAVA_HOME in windows 10. What is […]

  • 06 December

    Difference between replace() and replaceAll() in java

    In this post, we will see difference between String’s replace() and replaceAll() methods in java. String’s replace() and replaceAll() both replace all occurences in the String. String’s replace() takes either two chars or two CharSequences as arguments and it will replace all occurrences of char or String but replaceAll() method takes regex String as argument […]

  • Convert LocalDateTime to Timestamp in java
    18 November

    Convert LocalDateTime to Timestamp in Java

    In this post, we will how to convert LocalDateTime to Timestamp . Before learning how to convert localdatetime to timestamp, let us learn about LocalDateTime and Timestamp, and understand the importance of this conversion. LocalDateTime LocalDateTime was introcuded in Java 8. LocalDateTime can be imported time package: import java.time.LocalDateTime; LocalDateTime is an immutable object used […]

  • 11 November

    How to print array in java

    Learn about how to print array in java in multiple ways.

  • 12 October

    Java 9 JShell tutorial

    The Java JShell is a command-line tool that is introduced in Java 9 version. It helps to execute/test Java statements in a single line. It is based on REPL (Read Evaluate Print Loop) that reads a code statement, execute that and print the output, statement after statement. It reads the statement and immediately shows the […]

  • 11 October

    Java 9: Stream API Improvements

    In Java 9, following methods are added to Stream interface of stream package. These methods are default and static. The takeWhile() Method This method is included in Stream interface and used to collect the elements into a stream. It takes all the elements till the condition specified as predicate. For example, we want to collect […]

  • 09 October

    Find first and last digit of a number

    In this article, we are going to find first and last digit of a number. To find first and last digit of any number, we can have several ways like using modulo operator or pow() and log() methods of Math class etc. Let’s see some examples. Before moving to example, let’s first create an algorithm […]

  • 09 October

    Initialize 2D array in Java

    In this article, we will learn to initialize 2D array in Java. The array is a data structure that is used to collect a similar type of data into contiguous memory space. An array can be a single-dimensional or multidimensional. An array that has 2 dimensions is called 2D or two-dimensional array. There are several […]

  • 03 October

    Happy Number program in Java

    In this article, we are going to learn to find Happy Number using Java. Let’s first understand, what is Happy Number? What is a Happy Number? A number which leaves 1 as a result after a sequence of steps and in each step number is replaced by the sum of squares of its digit. For […]