• 18 January

    Even odd program in java

    In this post,we will see how to check if number is even odd. It is one of the basic programs of Java programming language. [crayon-61a2ce414a93b474043778/] Output: Enter a Number : 22 22 is an Even Number That’s all about Even odd program in java.

  • 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-61a2ce414bc08857727071/] Output: Enter two numbers : 5 7 Sum of two numbers is 12 If you notice, we have use Scanner to take input from user.

  • 10 October

    Java program to print table of number

    In this post we will see how to print table of number in java. It is good program to practice for loop in java. [crayon-61a2ce414c82b685516479/] Output: Enter a Number : 8 Table of 8 is 8 * 1 = 8 8 * 2 = 16 8 * 3 = 24 8 * 4 = 32 […]

  • 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-61a2ce414d272589818758/] 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 = […]

  • 10 November

    Java Format number as currency

    In this post, we are going to see how to format currency in java. We can format number into Currency by using NumberFormat class.We need to call NumberFormat.getInstance()  to get NumberFormat object by passing specified locale. For example: Let’s say you want a Format object for UK Locale or US Locale. You can simply use below […]

  • 01 November

    Java DecimalFormat example

    In this post, we will see how to format a number using DecimalFormat in java. DecimalFormat DecimalFormat class is subclass of NumberFormat class and it is used to format numbers by using specify formatting pattern.We can format a number upto 2 decimal place,upto 3 decimal place, using comma to separate digits. Creating DecimalFormat object [crayon-61a2ce414e45f906758192/] […]

  • 20 January

    How to check if number is power of two

    In this tutorial, we will see how to check if number is power of two. There are many approaches to check if number is power of two or not. Approach 1: It is very easy and straight forward approach. Run a while loop which checks for condition if n is even number (n%2==0). If n is […]

  • 08 August

    Fibonacci series program in java

    If you want to practice data structure and algorithm programs, you can go through 100+ java coding interview questions. Fibonacci series is numerical series in which next number is sum of previous two numbers. For example : 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 etc. There are two ways to print Fibonacci […]

  • 01 August

    Java program to check Armstrong number

    Armstrong number is a 3 digit number which is equal to sum of cube of its digits. For example: 371,153 In this post,  we will see how to check for Armstrong number in java. [crayon-61a2ce4150201378740799/] When you run above program, you will get following output. [crayon-61a2ce4150209892310260/] Please go through Frequently asked java interview Programs for more such […]