Category Archives: Basic Java Programs

Java Simple Calculator Program Using Switch

Java Simple Calculator Program Using Switch statement – We will write a simple Java calculator program. This  program will start by taking input from the user – two numbers and one operator. The operator will be from basic four operations like addition, subtraction, multiplication and division (+, – , * , / ). Source Code… Read More »

 4,965 total views,  3 views today

Counting Vowels in String Java Program

Topic: Counting Vowels in String Java, Counting Vowels in User Supplied String Java Program This topic covers – How to count the number of vowels in a give string using a Java Program. Source Code: import java.util.Scanner; public class CountingVowels { public static void main(String args[]){ int count = 0; System.out.println(“Enter a sentence :”); Scanner… Read More »

 381 total views

Java Vowel Count in String Program

Task: Write a Java program to count vowels in a given string input by the user at runtime. The Source Code of Java Vowel Count Program /* * Write down a Java program to input a string. * And count number of Vowels in it. */ package countvowelsinstring; import java.util.Scanner; /** * * @author www.EasyCodeBook.com… Read More »

 1,769 total views,  1 views today

Java Palindrome String Check

Task: Write down a Java String Program to check for Palindrome. The Source Code of Java Program Check for Palindrome import java.util.Scanner; /** * * @author www.EasyCodeBook.com */ public class StringPalindrome { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print(“Enter a String to check for Palindrome: “); String s1=input.nextLine(); String s2=””;… Read More »

 1,440 total views,  1 views today

Java String Class Reverse Program

Task: Write a Java String Class Reverse Program. You have to use only String class objects and String class built-in methods to reverse a user supplied string. Logic behind Java String Reverse Program You will use the following standard methods provided in String class: length() method to know the length of the original string. charAt(index)… Read More »

 942 total views,  2 views today

Java Day Number to Name switch Program

Task: Java Day Number to Name switch Program Java Program – The Use of Switch Statement through practical Java programming- Input a day number from the user Display Day Name. Source Code – Java Day Number to Name switch Program /* * Java Program – The Use of Switch Statement * Input a day number… Read More »

 336 total views,  1 views today

Write and Execute Java Addition Program

Task: Write and Execute Java Addition Program. This Java Programming Tutorial will provide and explain the source code of a basic addition program in Java. The program will input two numbers from the user at run time. The Java program will calculate the sum of these two numbbers and will display the answer of addition.… Read More »

 910 total views

Java Program Area of Triangle by Three Sides

Task: Write a Java Program Area of Triangle by Three Sides. The Source Code of Java Program Area of Triangle by Three Sides /* * Write a Java program to find the area of a triangle when lengths of three sides are given. */ package trianglearea; import java.util.Scanner; /** * @author www.EasyCodebook.com */ public class… Read More »

 815 total views

Java Program to Calculate Area of Circle

Task: Java Program to Calculate Area of Circle What is the formula for calculating Area of Circle? The required formula for calculating area of circle is: area = π . r2 Where r is the radius of the circle and π  is a mathematical constant with fixed value 3.1415. We should declare a constant for pi… Read More »

 1,779 total views,  5 views today