• 18 January

    Java Program to add two numbers

    In this post, we will see how to add two numbers in java. This is the most basic program of java programming language. [crayon-6742bf607dd9c491712415/] Output: Enter two numbers : 5 7 Sum of two numbers is 12 If you notice, we have use Scanner to take input from user.

  • 02 January

    Interface Segregation Principle in java

    In this tutorial, we will learn about Interface Segregation Principle.It is one of the SOLID principles. In simple term, Interface Segregation Principle dictates that client should not be forced to implement the methods which it won’t be able to use.You can always throw UnsupportedOperationException from the method which you don’t want to use but it […]

  • 02 January

    Open Closed Principle in Java

    In this tutorial, we will learn about Open Closed Design Principle in Java.Open closed principle is one of the SOLID principles. Open Closed Design Principle dictates that “software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification”. This definition was provided by Bertrand Meyer. Once we have written the class and […]

  • 28 December

    Single Responsibility Principle in Java

    In this tutorial, we will learn about single responsibility principle in java.It is one of SOLID principles and simplest design principle as well. Single responsibility principle dictates that there should be only one reason to change the class.If you have more than one reason to change the class then refactor the class into multiple classes according […]

  • 24 December

    Reverse number in java

    In this post, we will see how to reverse a number in java. Here is simple program to reverse a number. [crayon-6742bf607e466341905491/] Output: Enter a Number : 4567 Reverse of the number : 7654 Let’s just observe values of variables at the end of each iteration. Iteration 0: number = 4567,remainder = 0, reversedNumber = […]

  • Difference between Runnable and Callable in java
    16 December

    Difference between Runnable and Callable in java

    Runnable and Callable interface both are used in the multithreading environment.Callable is available in java.util.concurrent.Callable package and Runnable in java.lang.Thread. Difference between Runnable and Callable interface in java Runnable was introduced in java 1.0 version While Callable is an extended version of Runnable and introduced in java 1.5 to address the limitation of Runnable. Runnable […]

  • 14 December

    Java BigInteger to String

    In this tutorial, we will see how to convert BigInteger to String in java. There are many ways to convert BigInteger to String in java.Some of them are: Using toString() Using String.valueOf() toString method We can simply use BigInteger’s toString method to convert BigInteger to String. [crayon-6742bf607e5c9569876820/] When you run above program, you will get […]

  • 14 December

    Java String to BigInteger

    In this tutorial, we will see how to convert String to BigInteger in java. It is simple to convert String to BigInteger in java.We can simply use BigInteger’s constructor to convert String to BigInteger. [crayon-6742bf607e6a2266325154/] Above constructor convert String representation of BigInteger to BigInteger Let’s see this with the help of example: [crayon-6742bf607e6a6944916359/] When you […]

  • 14 December

    BigDecimal divide

    In this tutorial we will see about BigDecimal‘s divide method. BigDecimal’s divide method is used to divide one BigDecimal by another. You can specify scale and rounding mode to get the output according to your need. There are 6 overloaded versions of divide method. Syntax [crayon-6742bf607e75c706854281/] Return type returns BigDecimal BigDecimal round example Let’s understand […]