Home » Java Programs | Java Programming Examples

Java Programs | Java Programming Examples

by Online Tutorials Library

Java Programs | Java Programming Examples

Java programs are frequently asked in the interview. These programs can be asked from control statements, array, string, oops etc. Java basic programs like fibonacci series, prime numbers, factorial numbers and palindrome numbers are frequently asked in the interviews and exams. All these programs are given with the maximum examples and output. If you are new to Java programming, we will recommend you to read our Java tutorial first. Let’s see the list of Java programs.


Java Basic Programs

1) Fibonacci Series in Java

2) Prime Number Program in Java

3) Palindrome Program in Java

4) Factorial Program in Java

5) Armstrong Number in Java

6) How to Generate Random Number in Java

7) How to Print Pattern in Java

8) How to Compare Two Objects in Java

9) How to Create Object in Java

10) How to Print ASCII Value in Java

Java Number Programs

1) How to Reverse a Number in Java

2) Java Program to convert Number to Word

3) Automorphic Number Program in Java

4) Peterson Number in Java

5) Sunny Number in Java

6) Tech Number in Java

7) Fascinating Number in Java

8) Keith Number in Java

9) Neon Number in Java

10) Spy Number in Java

11) ATM program Java

12) Autobiographical Number in Java

13) Emirp Number in Java

14) Sphenic Number in Java

15) Buzz Number Java

16) Duck Number Java

17) Evil Number Java

18) ISBN Number Java

19) Krishnamurthy Number Java

20) Bouncy Number in Java

21) Mystery Number in Java

22) Smith Number in Java

23) Strontio Number in Java

24) Xylem and Phloem Number in Java

25) nth Prime Number Java

26) Java Program to Display Alternate Prime Numbers

27) Java Program to Find Square Root of a Number Without sqrt Method

28) Java Program to Swap Two Numbers Using Bitwise Operator

29) Java Program to Find GCD of Two Numbers

30) Java Program to Find Largest of Three Numbers

31) Java Program to Find Smallest of Three Numbers Using Ternary Operator

32) Java Program to Check if a Number is Positive or Negative

33) Java Program to Check if a Given Number is Perfect Square

34) Java Program to Display Even Numbers From 1 to 100

35) Java Program to Display Odd Numbers From 1 to 100

36) Java Program to Find Sum of Natural Numbers

Java Array Programs

1) Java Program to copy all elements of one array into another array

2) Java Program to find the frequency of each element in the array

3) Java Program to left rotate the elements of an array

4) Java Program to print the duplicate elements of an array

5) Java Program to print the elements of an array

6) Java Program to print the elements of an array in reverse order

7) Java Program to print the elements of an array present on even position

8) Java Program to print the elements of an array present on odd position

9) Java Program to print the largest element in an array

10) Java Program to print the smallest element in an array

11) Java Program to print the number of elements present in an array

12) Java Program to print the sum of all the items of the array

13) Java Program to right rotate the elements of an array

14) Java Program to sort the elements of an array in ascending order

15) Java Program to sort the elements of an array in descending order

16) Java Program to Find 3rd Largest Number in an array

17) Java Program to Find 2nd Largest Number in an array

18) Java Program to Find Largest Number in an array

19) Java to Program Find 2nd Smallest Number in an array

20) Java Program to Find Smallest Number in an array

21) Java Program to Remove Duplicate Element in an array

22) Java Program to Print Odd and Even Numbers from an array

23) How to Sort an Array in Java


Java Matrix Programs

1) Java Matrix Programs

2) Java Program to Add Two Matrices

3) Java Program to Multiply Two Matrices

4) Java Program to subtract the two matrices

5) Java Program to determine whether two matrices are equal

6) Java Program to display the lower triangular matrix

7) Java Program to display the upper triangular matrix

8) Java Program to find the frequency of odd & even numbers in the given matrix

9) Java Program to find the product of two matrices

10) Java Program to find the sum of each row and each column of a matrix

11) Java Program to find the transpose of a given matrix

12) Java Program to determine whether a given matrix is an identity matrix

13) Java Program to determine whether a given matrix is a sparse matrix

14) Java Program to Transpose matrix


Java String Programs

1) Java Program to count the total number of characters in a string

2) Java Program to count the total number of characters in a string 2

3) Java Program to count the total number of punctuation characters exists in a String

4) Java Program to count the total number of vowels and consonants in a string

5) Java Program to determine whether two strings are the anagram

6) Java Program to divide a string in ‘N’ equal parts.

7) Java Program to find all subsets of a string

8) Java Program to find the longest repeating sequence in a string

9) Java Program to find all the permutations of a string

10) Java Program to remove all the white spaces from a string

11) Java Program to replace lower-case characters with upper-case and vice-versa

12) Java Program to replace the spaces of a string with a specific character

13) Java Program to determine whether a given string is palindrome

14) Java Program to determine whether one string is a rotation of another

15) Java Program to find maximum and minimum occurring character in a string

16) Java Program to find Reverse of the string

17) Java program to find the duplicate characters in a string

18) Java program to find the duplicate words in a string

19) Java Program to find the frequency of characters

20) Java Program to find the largest and smallest word in a string

21) Java Program to find the most repeated word in a text file

22) Java Program to find the number of the words in the given text file

23) Java Program to separate the Individual Characters from a String

24) Java Program to swap two string variables without using third or temp variable.

25) Java Program to print smallest and biggest possible palindrome word in a given string

26) Reverse String in Java Word by Word

27) Reserve String without reverse() function


Java Searching and Sorting Programs

1) Linear Search in Java

2) Binary Search in Java

3) Bubble Sort in Java

4) Selection Sort in Java

5) Insertion Sort in Java


Java Conversion Programs

1) How to convert String to int in Java

2) How to convert int to String in Java

3) How to convert String to long in Java

4) How to convert long to String in Java

5) How to convert String to float in Java

6) How to convert float to String in Java

7) How to convert String to double in Java

8) How to convert double to String in Java

9) How to convert String to Date in Java

10) How to convert Date to String in Java

11) How to convert String to char in Java

12) How to convert char to String in Java

13) How to convert String to Object in Java

14) How to convert Object to String in Java

15) How to convert int to long in Java

16) How to convert long to int in Java

17) How to convert int to double in Java

18) How to convert double to int in Java

19) How to convert char to int in Java

20) How to convert int to char in Java

21) How to convert String to boolean in Java

22) How to convert boolean to String in Java

23) How to convert Date to Timestamp in Java

24) How to convert Timestamp to Date in Java

25) How to convert Binary to Decimal in Java

26) How to convert Decimal to Binary in Java

27) How to convert Hex to Decimal in Java

28) How to convert Decimal to Hex in Java

29) How to convert Octal to Decimal in Java

30) How to convert Decimal to Octal in Java


Java Pattern programs

1) Java program to print the following spiral pattern on the console

2) Java program to print the following pattern

3) Java program to print the following pattern 2

4) Java program to print the following pattern 3

5) Java program to print the following pattern 4

6) Java program to print the following pattern 5

7) Java program to print the following pattern on the console

8) Java program to print the following pattern on the console 2

9) Java program to print the following pattern on the console 3

10) Java program to print the following pattern on the console 4

11) Java program to print the following pattern on the console 5

12) Java program to print the following pattern on the console 6

13) Java program to print the following pattern on the console 7

14) Java program to print the following pattern on the console 8

15) Java program to print the following pattern on the console 9

16) Java program to print the following pattern on the console 10

17) Java program to print the following pattern on the console 11

18) Java program to print the following pattern on the console 12


Java Singly Linked List Programs

1) Singly linked list Examples in Java

2) Java Program to create and display a singly linked list

3) Java program to create a singly linked list of n nodes and count the number of nodes

4) Java program to create a singly linked list of n nodes and display it in reverse order

5) Java program to delete a node from the beginning of the singly linked list

6) Java program to delete a node from the middle of the singly linked list

7) Java program to delete a node from the end of the singly linked list

8) Java program to determine whether a singly linked list is the palindrome

9) Java program to find the maximum and minimum value node from a linked list

10) Java Program to insert a new node at the middle of the singly linked list

11) Java program to insert a new node at the beginning of the singly linked list

12) Java program to insert a new node at the end of the singly linked list

13) Java program to remove duplicate elements from a singly linked list

14) Java Program to search an element in a singly linked list


Java Circular Linked List Programs

1) Java program to create and display a Circular Linked List

2) Java program to create a Circular Linked List of N nodes and count the number of nodes

3) Java program to create a Circular Linked List of n nodes and display it in reverse order

4) Java program to delete a node from the beginning of the Circular Linked List

5) Java program to delete a node from the end of the Circular Linked List

6) Java program to delete a node from the middle of the Circular Linked List

7) Java program to find the maximum and minimum value node from a circular linked list

8) Java program to insert a new node at the beginning of the Circular Linked List

9) Java program to insert a new node at the end of the Circular Linked List

10) Java program to insert a new node at the middle of the Circular Linked List

11) Java program to remove duplicate elements from a Circular Linked List

12) Java program to search an element in a Circular Linked List

13) Java program to sort the elements of the Circular Linked List


Java Doubly Linked List Programs

1) Java program to convert a given binary tree to doubly linked list

2) Java program to create a doubly linked list from a ternary tree

3) Java program to create a doubly linked list of n nodes and count the number of nodes

4) Java program to create a doubly linked list of n nodes and display it in reverse order

5) Java program to create and display a doubly linked list

6) Java program to delete a new node from the beginning of the doubly linked list

7) Java program to delete a new node from the end of the doubly linked list

8) Java program to delete a new node from the middle of the doubly linked list

9) Java program to find the maximum and minimum value node from a doubly linked list

10) Java program to insert a new node at the beginning of the Doubly Linked list

10) Java program to insert a new node at the end of the Doubly Linked List

12) Java program to insert a new node at the middle of the Doubly Linked List

13) Java program to remove duplicate elements from a Doubly Linked List

14) Java program to rotate doubly linked list by N nodes

15) Java program to search an element in a doubly linked list

16) Java program to sort the elements of the doubly linked list


Java Tree Programs

1) Java Program to calculate the Difference between the Sum of the Odd Level and the Even Level Nodes of a Binary Tree

2) Java program to construct a Binary Search Tree and perform deletion and In-order traversal

3) Java program to convert Binary Tree to Binary Search Tree

4) Java program to determine whether all leaves are at same level

5) Java program to determine whether two trees are identical

6) Java program to find maximum width of a binary tree

7) Java program to find the largest element in a Binary Tree

8) Java program to find the maximum depth or height of a tree

9) Java program to find the nodes which are at the maximum distance in a Binary Tree

10) Java program to find the smallest element in a tree

11) Java program to find the sum of all the nodes of a binary tree

12) Java program to find the total number of possible Binary Search Trees with N keys

13) Java program to implement Binary Tree using the Linked List

14) Java program to search a node in a Binary Tree

Next TopicJava OOPs Concepts

You may also like