Tag Archives: Java tutorial

Learn Java by Example: Java Program to Find the Largest Among Three Numbers

Java Program to Find the Largest Among Three Numbers In this program, you’ll learn to find the largest among three numbers using if else and nested if..else statement in Java.   Example 1: Find Largest Among three numbers using if..else statement public class Largest{ public static void main(String[] args){ double n1 = -4.5, n2 = …

Learn Java by Example: Java Program to Check Whether an Alphabet is Vowel or Consonant

Java Program to Check Whether an Alphabet is Vowel or Consonant In this program, you’ll learn to check whether an alphabet is a vowel or a consonant using if..else and switch statement in Java.   Example 1: Check whether an alphabet is vowel or consonant using if..else statement public class VowelConsonant{ public static void main(String[] …

Java Example – Java Program to Swap Two Numbers

Java Program to Swap Two Numbers In this program, you’ll learn two techniques to swap two numbers in Java. The first one uses a temporary variable for swapping, while the second one doesn’t use any temporary variables.   Example 1: Swap two numbers using temporary variable public class SwapNumbers{ public static void main(String[] args){ float …

Learn Java by Example: Java Program to Compute Quotient and Remainder

Java Program to Compute Quotient and Remainder In this program, you’ll learn to compute quotient and remainder from the given dividend and divisor in Java.   Example: Compute Quotient and Remainder public class QuotientRemainder{ public static void main(String[] args){ int dividend = 25, divisor = 4; int quotient = dividend / divisor; int remainder = …

Learn Java by Example: Java Program to Find ASCII Value of a character

Java Program to Find ASCII Value of a character In this program, you’ll learn to find and display the ASCII value of a character in Java. This is done using type-casting and normal variable assignment operations.   Example: Find ASCII value of a character public class AsciiValue{ public static void main(String[] args){ char ch = …

Learn Java by Example: Java Program to Multiply two Floating Point Numbers

Java Program to Multiply two Floating Point Numbers In this program, you’ll learn to multiply two floating point numbers in Java, store the result and display it on the screen.   Example: Multiply Two Floating-Point Numbers public class MultiplyTwoNumbers{ public static void main(String[] args){ float first = 1.5f; float second = 2.0f; float product = …

Java tutorials for Beginners – Java ByteArrayInputStream Class

(Java programming Example for Beginners) Java ByteArrayInputStream Class In this tutorial, we will learn about Java ByteArrayInputStream and its methods with the help of examples. The ByteArrayInputStream class of the java.io package can be used to read an array of input data (in bytes). It extends the InputStream abstract class. Note: In ByteArrayInputStream, the input stream is created using the array of …