Java Programs : This article includes various Java programs covering all the topics such as control statements, strings, arrays, loops, classes, functions, matrices, etc. For all these simple and basic Java programs, we provide multiple examples and the compiled code result.

Java is a high level object oriented programming language that runs on various platforms, including Windows, mac os, Unix, etc. Before going through these Java programming examples, please visit our Tutorial section to learn Java Programming language with examples.

## Basic Java Programs for Beginners

We start this section with the hello world program and cover all the programs, ranging from basic to advanced programs, with proper explanation.

For most of the examples, we used the scanner class to accept the user inputs and pass them to the public static void main string args method.

- Java Programs to print Hello World
- Get Input from User
- Java program to print an Integer
- Java Program to Read Integer Value from the Standard Input
- Java program to add Two Numbers
- Java program to add Two Complex Numbers
- Java program to find Compound Interest
- Java Program to check Number Divisible by 5 and 11
- Java Program to find Cube of a Number
- Java program to find GCD of a Number
- Java Program to find Largest of Two Numbers
- Java Program to find largest of Three Numbers
- Java Program to find the Average of Three Numbers
- Java Program to find the Smallest of Three Numbers
- Java program to find LCM of a Number
- Java Program to print Multiplication Table
- Java Programs for Odd or Even
- Java Programs to find Positive or Negative Number
- Java program to find Power of a Number
- Java program to calculate Profit or Loss
- Java program to print 1 to 100 without using Loops
- Java program to find Roots of a Quadratic Equation
- Java program to find Square of a Number
- Java program to find Square Root of a Number
- Java Program to find Square Root of a Number without sqrt
- Java program to calculate Simple Interest
- Java program to calculate Student Grade
- Java Programs to find Total Average and Percentage of Five Subjects
- Java program to Multiply Two Numbers
- Java Program to Multiply Two Floating Point Numbers
- Java program to Create a Simple Calculator
- Java program to Compute Quotient and Remainder
- Java Permutation and Combination Program
- Java Random Number Generator

Please refer to the Java program to print Natural Numbers article to understand the programming logic to print the first 10 odd, even, and Natural numbers. You can also find the programs to print even, odd natural numbers from 1 to 100 or 1 to N and their Sum.

## Java Programs on Characters

The following are generally asked character programs

- Java Program to find ASCII Value of a Character
- find ASCII value of all Characters
- display Alphabets from a to z
- print Alphabets from A to Z
- Character is Alphabet or Not
- Character is Vowel or Consonant

## Advanced Java Programs on Numbers

This section covers some advanced concepts you might face in coding interviews to filter the experienced programmers. They are the Fibonacci series, Armstrong number, palindrome, random numbers, etc.

- Java Programs to Add Two Binary Numbers
- Armstrong Number
- Java Program to Check Peterson Number
- Java Program to Check Spy Number
- Java Program to Check Sunny Number
- Java Program to Check Tech Number
- Java program to count Digits in a Number
- Electricity Bill Program
- Java program to find Factors of a Number
- Factorial Program
- Fibonacci Series
- Java Programs to Generate Random Numbers
- Java Programs to Break Integer into Digits
- Java program to find the First Digit of a Number
- Java program to find the First and Last Digit of a Number
- Java program to find the Generic Root of a Number
- Java program to find the Last Digit of a Number
- Perfect Number Program
- Palindrome Program
- Java program to check Prime Number or Not
- Java program to print Prime Numbers from 1 to N
- Java Program to Print first 100 Prime Numbers
- Java program to find Sum of Prime Numbers from 1 to N
- Java program to Reverse a Number
- Java program to check Strong Number
- Sum of Digits in a Number
- Java Programs to Swap Two Numbers
- Java Programs to Get the IP address
- Find Arithmetic Sum using Method Overloading

## Java Area Programs

The Area examples article shows the list of Java programs to find the area and perimeter of a circle, triangle, trapezoid, rhombus, etc. It also covers the Surface area and Volume of the Sphere, Cylinder, Cube, Cuboid, and Cone.

## Java String programs

The below program accepts the given string and works on all the elements or character array in string args.

- Tutorial on Java programming language
- Java Program to Print Characters in a String
- Java program to print ASCII values of String Characters
- Java program to concat Strings
- Java program to convert Lowercase to Uppercase
- Java program to convert Uppercase to Lowercase
- Java program to count Total Characters in a String
- Java program to count Total Words in a String
- Java programs to count Alphabets Digits & Special Characters in a String
- Java program to count Vowels and Consonants in a String
- The Java program to find All Occurrences of a Character in a String article contains information about finding, replacing, and deleting first, last, maximum, and minimum occurring characters.
- Java program to check Palindrome String
- Java program To remove all whitespaces from a String
- Reverse Letters in a String
- Reverse a String
- String Reverse using Recursion
- Toggle All Characters in a String
- String Comparison
- Sort Strings in Alphabetical Order

## Java Conversion Programs

The Conversion article shows the available list of conversion programs and multiple examples. The common and frequently asked programs are to convert Int to String and String to Integer.

## Java Programs on Dates

## Array Programs in Java

- Java Program to Print Array Elements
- perform Arithmetic Operations on Array
- copy an Array to another
- Count Occurrence of an Element in an Array
- Count Even Numbers in an Array
- Count Even and Odd Numbers in an Array
- Count Odd Numbers in an Array
- Count Positive Array Numbers
- Count Negative Array Numbers
- Count Positive and Negative Numbers in an Array
- Count Array Duplicates
- Count Frequency of each Element in an Array
- Calculate Average of an Array
- Java Program to Delete Array Duplicates
- Java Program to Increment All Elements of an Array by One
- print Largest Array Number
- print Largest and Smallest Array Number
- Print Negative Array Numbers
- Print Positive Array Numbers
- Put Positive and Negative Numbers in Separate Array
- Second Largest Array Number
- Smallest Array Number
- Sort Array Elements in Ascending Order
- Sort Array Elements in Descending Order
- Sum of All Elements in an Array
- Sum of Even Numbers in an Array
- Sum of Even and Odd Numbers in an Array
- Sum of Odd Numbers in an Array
- Reverse an Array
- Swap Two Array without using Temp Variable
- Unique Array Items
- Print Kth element in an Array
- Find the Number of Elements in an Array

## Java Programs on Matrix

- Java Program to Print Matrix Items
- Perform Arithmetic operations on Matrix
- Add Two Matrices
- Check Two Matrices are Equal
- Calculate Determinant of a Matrix
- Check Identity Matrix
- Interchange Matrix Diagonals
- Print Lower Triangle of a Matrix
- Multiply two Matrices
- Scalar Matrix Multiplication
- Sparse Matrix
- Subtract two Matrices
- Sum of the Matrix Lower Triangle
- Sum of the Matrix Upper Triangle
- Sum of Matrix Opposite Diagonal
- Sum of Matrix Diagonal
- Sum of each Matrix Column
- Sum of each Matrix Row
- Sum of Matrix Rows and Column
- Symmetric Matrix
- Transpose Matrix
- Upper Triangle of a Matrix
- Find the Normal of a Matrix
- Find the Trace of a Matrix

## Java Programs for Sorting & Searching

- Java Bubble Sort on Integers
- Java Programming examples to perform Bubble Sort in Descending Order
- Java Programming examples to perform Bubble Sort on Strings
- Java Programming examples to perform Binary Search
- Java Programming examples to perform Linear Search
- Java Programming examples to perform Selection Sort

## Java Pattern Programs

You can use the For Loops, Do While loops, and While loops to develop any pattern programs in Java. There are many pattern programs, so please refer to the following hyperlinks to see their list.

Comments are closed.