Java Example Programs


Java Example Programs

Java Examples

Java is a widely used general purpose versatile programming language known for its platform independence and strong emphasis on portability. Java has a significant presence in diverse fields, including web development, mobile applications, and enterprise systems.

Writing programs in Java is the best way to learn Java. The page contains examples programs for basic java concepts. You should go through all of these examples and attempt them on your own.

Java Fundamental Programs Java Program to Print Hello World Java Program for Basic Input and Output Java Program to Check Odd or Even Numbers Java Program to Check Whether a Number is Positive or Negative Java Program to Find Largest of Three Numbers Java Program to Swap Two Numbers Java Program to Print ASCII Value of All Alphabets Java Program to Check a Character is Vowel or Consonant Java Program to Calculate Arithmetic Mean of N Numbers Java Program to Calculate Average and Percentage Marks Java Program to Find Area and Perimeter of Rectangle Java Program to Print Fibonacci Series with and without using Recursion Java Program to Check Whether a Number is Palindrome or Not Java Program to Find Sum of all Odd Numbers between 0 to N Java Program to Add Two Numbers Java Program to Add Subtract Multiply and Divide Two Numbers Java Program to Find LCM and GCD of Two Numbers Java Program to Check Whether a Number is Armstrong Number or Not Java Program to Print Armstrong Numbers Between 1 to N Java Program to Reverse a Number using Recursion Java Program to Check Perfect Number or Not Java Program to Find All Factors of a Number Java Program to Check a Number is Prime Number or Not Java Program to Print Prime Numbers between 1 to 100 Java Program to Find Sum of Digits of a Number Java Program to Count Number of Digits in a Number Java Program To Reverse Digits of a Number using While Loop Java Program to Find Factorial of a Number using For Loop Java Program to Find Factorial of a Number Using Recursion Java Program to Print Multiplication Table of Number Java Program to Make a Simple Calculator using Switch Statement Java Program to Calculate Simple Interest Java Program to Check If a Year is Leap Year or Not Java Program to Calculate Compound Interest Java Program to Convert Celsius to Fahrenheit Java Program to Convert Fahrenheit to Celsius Java program to convert binary number to decimal number Java Program to Convert Decimal to Binary Numbers Java Program to Convert Octal Number to Decimal Number Java Program to calculate area and circumference of circle Java Program to Find Area of Right Angled Triangle Java Program to Find Area Of Triangle Java Program to Find Area Of Trapezoid Java Program to find Area Of Equilateral Triangle Java Program to Calculate Volume of Sphere Java Program to Find Surface Area and Volume of Cylinder Java Program to Calculate Surface Area and Volume of Cube Java Program to Find Volume and Surface Area of Cuboid Java Program to Calculate Volume and Surface Area of Cone Java Program to Calculate Grade of Students Java Program to generate a sequence of random numbers Java Program to Find Sum of Harmonic Series Java Program for Matrix Multiplication Java Program to Find Transpose of a Matrix Java Program to Find Length of a String Java Program to Copy a String Java Program to Concatenate Two Strings Java Program to Reverse a String Java Program to Delete All Spaces from a String Java Program to Find Count of Each Character in a String Java Program to Check Two Strings are Anagram or Not Java Program to Delete all Vowel Characters from String Java Program to Check Whether two Strings are Equal or Not Java Program to Delete a Word from Sentence Java Program to Count Words in a Sentence Java Program to Reverse Sequence of Words of a Sentence Java Program to Print Pascal Triangle Java Program to Print Right Triangle Star Pattern Java Program to Print Inverted Right Triangle Star Pattern Java Program to Print Pyramid Pattern of Stars Java Program to Print Inverted Pyramid Pattern of Stars Java Program to Print Right Triangle Pattern of Natural Numbers Java Program to Print Diamond Pattern of Star Character Java program to Print Square Pattern of Star Character Java Program to Print Multiplication Table Triangle Pattern Java Program to Find Sum of Elements of an Array Java Program to Search an Element in an Array using Linear Search Java Program to Find Average of all Array Elements Java Program to Merge Two Sorted Arrays Java Program to Insert an Element in Array at Given Position Java Program to Find Duplicate Elements in an Array Java Program to Find Largest and Smallest Number in an Array Java Program to Delete an Element from Array at Given Position Java Program to Reverse Array Elements Java Program Number Triangle Pattern Five Java Program to Print Palindrome Pyramid Pattern Java Program to Print an Integer Entered by User Java Program to Multiply two Floating Point Numbers Java Program to Find Quotient And Remainder Java Program to Find all Roots of a Quadratic Equation Java Program to Check Whether a Character is Alphabet or Not Java Program to Calculate the Power of a Number Java Program to Display Alphabets using Loop Java Program to Find the Sum of Natural Numbers using Recursion Java Program to Split a Number into Two Prime Number Java Program to Calculate Power of a Number using Recursion Java Program to Find GCD Using Recursion Java Program to Calculate Standard Deviation Java Program to Add Two Matrices Java Program to Count the Number of Vowels and Consonants Java Program to Calculate Difference Between Two Time Periods Java Program to Print All Elements of an Array Java Program to Convert String to Date Java Program to Round a Number to n Decimal Places Java Program to Concatenate Two Arrays Java Program to Convert Character to String Java Program to Check if a String is Empty or Null Java Program to Get Current Date and Time Java Program to Convert Integer to Long Java Program to Convert Boolean Variable to String Java Program to Convert String to Boolean Java Program to Convert a String to Int Java Program to Convert Long to Int Java Program to Convert Integer to Char Java Program to Convert Char to Int Java Program to Check if a String is valid Number Java Program to Add Two Dates Java Program to Get Current Working Directory Java Program to Read Strings From a Text File Java Program to Lookup Enum by String Value Java Program to Append Text to an Existing File Java Program to Convert Integer to String Java Program to Convert Integer to Double Java Program to Convert Double to Integer Java Program to Convert String to Double Java Program to Print Isosceles Triangle Star Pattern Java Program to Convert Decimal to HexaDecimal Number Java Program to Create Custom Exception Class Java Program to Find the Class Name of an Object Java Program to Implement Private Constructors Java Program to Call One Constructor from Another Java Program to Calculate the Execution Time of Methods Java Program To Count Number of Lines In The File Java Program to Delete a File in Java Java Program to Create File and Write to the File Java Program to Display the Name and Version of Operating System Java Program to Compute All Permutations of a String Java Program to Iterate Over Enum Values Java Program to Check Birthday and Print Happy Birthday Java Program For Switch Case Statement on String Java Program to Iterate Through Each Character of a String Java Program To Convert Primitive Data Types To Objects Java Program to Convert Double to String Java Program to Convert String to Double