Category Archives: Java

Java Arrays sort Method to Sort Arrays

Task: Write a Java Program to use Java Arrays sort Method to Sort Arrays in Ascending Order. Use arrays containing of different types of data that is arrays of integers, arrays of doubles or arrays of strings strings etc. What is Java Arrays sort Method? Actually there is a class in java.util package known as… Read More: Java Arrays sort Method to Sort Arrays »

Loading

Java Program For Input Numbers in Array

Task: Java Program For Input Numbers in Array and display them. The source code for  Java program to declare and enter numbers in array, and display them using for loop /* * Write a Java program to declare one dimentionalarray of 10 integers. Input numbers using for loop and display them. */ package inputnumbersarray; import… Read More: Java Program For Input Numbers in Array »

Loading

Java Program to Count Digits of Number Using While Loop

Task: Write a Java Program to Count Digits of Number The source of Java Program to Count digits of a number input by the user at run time is: /* * Write a Java program to input a number and count its digit */ package countdigits; /** * @author www.EasyCodeBook.com */ import java.util.Scanner; public class… Read More: Java Program to Count Digits of Number Using While Loop »

Loading

Using Recursion in Java Find Factorial of Number

Task: Write a program Using Recursion in Java Find Factorial of Number. The source code of Java program to find factorial of a given number using recursion is: /* Write a Java program to calculate factorial of a number. Use a recursive method. */ package recursivefactorial; /** * @author www.EasyCodeBook.com */ import java.util.Scanner; public class… Read More: Using Recursion in Java Find Factorial of Number »

Loading

Recursion in Java Explained With Examples

Java Programming Tutorial: Recursion in Java With Examples of Recursive Methods What is Recursion? Recursion may be defined as, “the process of invoking (and restarting) the same method that is currently executing is called Recursion”. Another Definition of Recursion – Recursion in Java A programming technique in which a method calls it self is known… Read More: Recursion in Java Explained With Examples »

Loading

Java Program To Check a Number is Even or Odd

Task: Write a Java Program To Check a Number is Even or Odd The Source Code for Even Odd Checking Java Program /* Write a Java Program for checking a number is even or odd */ package evenodd; /** * @author www.EasyCodeBook.com */ import java.util.Scanner; public class EvenOdd { public static void main(String[] args) {… Read More: Java Program To Check a Number is Even or Odd »

Loading

Java Program To Check a Number is Prime or Composite

Task:Write a Java Program To Check a Number is Prime or Composite The Source code for Java Program to input a number and check whether it is prime number or composite /* Write a Java program to input a number and check it whether it is prime or composite number. */ package primenocheck; /** *… Read More: Java Program To Check a Number is Prime or Composite »

Loading

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: Java Program to Calculate Area of Circle »

Loading

Java Program To Input a Number and Display Its Square

Task: Write a Java Program To Input a Number and Display Its Square. The sample run of the required Java program is shown in the image below: Stop Here, Please, Click to Read : Getting input from keyboard in Java, first For getting input in a Java program, we may use the Scanner class. Please… Read More: Java Program To Input a Number and Display Its Square »

Loading

Get Keyboard Input in Basic Java Program

Task: Steps to Get Keyboard Input in Basic Java Program The Input For Java Console Applications ( Basic Java Programs ) Java Console Applications are the basic programs to start learning Java Programming Language. The new Java programmers wish to write general programs with run time input from the user. For example, suppose  we wish… Read More: Get Keyboard Input in Basic Java Program »

Loading