• 19 January

    Java Program to Check Whether a Character is Alphabet or Not

    This tutorial provides Java Program to Check Whether a Character is Alphabet or Not. [crayon-6638c619d0d39014544416/] Output: Enter a Character : d d is an alphabet. The ASCII value of lowercase alphabets range from 97 to 122. And, the ASCII value of uppercase alphabets range from 65 to 90. That’s why, we compared variable character between […]

  • 19 January

    Java program to check leap year

    In this post, we will see how to check leap year. [crayon-6638c619d16e5262584107/] Output: Enter Year : 2018 2018 is not a Leap Year That’s all about Java program to check leap year.

  • 19 January

    Java Program to check a Character is Vowel or Consonant

    In this post, we will see how to check a Character is Vowel or Consonant. You just need to check if character is part of set {a,A,e,E,i,I,o,O,u,U}.If it is part of set then it is Vowel else Consonant. [crayon-6638c619d1838607235824/] Output: Enter an Alphabet : g g is a Consonant That’s all about Java Program to […]

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

  • 03 January

    java round double/float to 2 decimal places

    In this post, we will see how to round double to 2 decimal places in java. There are many ways to do it.Let’s go through few ways. Let’s understand each with the help of simple example. Using DecimalFormat You can use DecimalFormat too to round number to 2 decimal places. [crayon-6638c619d2716300423919/] Output: Rounded double (DecimalFormat) […]

  • 03 January

    How to get square root of number in java

    In this tutorial. we will see if how to get square root of number in java. It is very simple to get square root of number in java. You can simply use Math’s sqrt() method to calculate square root of number. Syntax [crayon-6638c619d2ba4504559106/] Return type It returns square root of the number. Square root of […]

  • 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 […]