• 19 January

    Java program for sum of digits of number

    In this post, we will see how to find sum of digits of number in java. You can find unit’s place digit by number%10, add it to the total and divide the number by 10 to remove the unit’s place. import java.util.Scanner; public class DigitAdditionCalc { public static void main(String args[]) { int number, remdr=0, […]

  • 19 January

    Java program to calculate average marks

    In this post, we will see simple java program to find average and percentage marks. We have taken average and percentage of five subject marks below. import java.util.Scanner; public class MarksCalculator { public static void main(String args[]) { int markArray[] = new int[5]; int i; float sum=0; float average, percentage; Scanner scan = new Scanner(System.in); […]

  • 19 January

    Java program to make simple calculator

    In this post, we will see how to create a simple calculator in java. This calculator program performs 4 basic operatios – Addition, Substraction, Multiplication and division.It uses Switch case to choose operation you want to perform. import java.util.Scanner; public class Calculator { public static void main(String args[]) { float num1, num2, result; char operation, […]

  • 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. import java.util.Scanner; public class AlphabetFinder { public static void main(String args[]) { char character; Scanner scanner = new Scanner(System.in); System.out.print("Enter a Character : "); character = scanner.next().charAt(0); if((character>='a' && character<='z') || (character>='A' && character<='Z')){ System.out.print(character + " is an alphabet."); }else{ […]

  • 19 January

    Java program to check leap year

    In this post, we will see how to check leap year. import java.util.Scanner; public class LeapYearFinder { public static void main(String args[]) { int year; Scanner scanner = new Scanner(System.in); System.out.print("Enter Year : "); year = scanner.nextInt(); if((year%4 == 0) && (year%100!=0)){ System.out.print(year+" is a Leap Year"); }else if(year%100 == 0){ System.out.print(year+" is not a […]

  • 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. import java.util.Scanner; public class VowelFinder { public static void main(String args[]) { char character; Scanner sacnner = […]

  • 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. import java.util.Scanner; public class EvenOddFinder { public static void main(String args[]) { int num; Scanner scanner = new Scanner(System.in); System.out.print("Enter a Number : "); num = scanner.nextInt(); if(num%2 == 0) { […]

  • 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. import java.util.Scanner; public class Calculator { public static void main(String args[]) { int num1, num2, sum; // Taking input from user Scanner scanner = new Scanner(System.in); System.out.print("Enter two numbers : "); num1 […]

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

Subscribe to our newletter

Get quality tutorials to your inbox. Subscribe now.