Categories: Java

# Java Programs – 10 Simple And Easy Programs

## Introduction

Java is one of the most prominent programming languages commonly used in the IT industry. It’s simple, stable, and it allows us to reuse the code. Easy Java programs for beginners are ideal for evaluating the coding skills of the programmer. You’ll find coding related questions in almost every interview. A simple Java program will have a class and a key method with some statements within it. Everything in Java has to be in a class. The script is saved with the .Java extension. In this article, let’s see some of the essential programs for understanding the fundamentals of basic Java programming.

The following is a list of Java programs that are easy to understand and implement –

## 1. Java program to perform basic Calculator operations.

When you think of a calculator, operations such as addition, subtraction, multiplication, and division fall come into your mind. Let us implement simple calculator operations with the aid of the script below.

When you run the above program, the output appears as shown below:

## 2. Java program to calculate a Factorial of a number.

The factor of a number is the product of all real numbers less than or equal to a number. The factorial number n is denoted by n!

When you run the above program, the output appears as shown below:

## 3.  Java program to calculate Fibonacci Series up to n numbers.

It is a sequence in which the next term is the sum of the two preceding terms. For example: 0 1 2 3 5 8 13. Let’s write a Java program for the Fibonacci series.

When you run the above program, the output appears as shown below:

## 4. Java program to find out whether the given String is Palindrome or not.

A palindrome is a number, series, or sequence that will be the same even after the order has been reversed. For example, if RACECAR is written backward, it would be the same as RACECAR.

When you run the above program, the output appears as shown below:

## 5.  Java program to calculate Permutation and Combination of 2 numbers.

These are the various arrangements of a given number of elements, taken one by one or several, or all at a time. Let’s take a look at its implementation.

When you run the above code, the output appears as shown below:

## 6. Java program to find out the Alphabet and Diamond Pattern.

Here, you can use the Java loop to print different patterns. In this post, we will see two separate patterns. The first is the Alphabet A pattern, and the second is the Diamond-shaped pattern.

Now let’s see the pattern of the alphabet A.

When you run the above code, the output appears as shown below:

Now, let’s see the Diamond pattern in Java.

When you run the above code, the output of the Diamond-Shaped Pattern program will appear as below:

## 7. Java Program to reverse the letters present in the given String.

This Java program reverses the letters present in the string user enters. For example, Welcome People will get converted into ‘emoceleW elpoeP’. Let’s use Java to implement the same thing.

When you run the above code, the output appears as shown below:

## 8. Java Program to check whether the given array is Mirror Inverse or not.

The array is called the mirror – inverse if the inverse is equal to itself. Let’s see a program to check whether or not the given array is mirror inverse.

When you run the above code, the output appears as shown below:

// If the given array was {3,4,2,0,1}, it would have printed yes as output because the array is mirror inverse.

## 9.  Java program to calculate the average of numbers with rounding half-up and scale 2.

Let’s see a program to calculate the average of numbers with rounding half-up and scale 2.

When you run the above code, the output appears as shown below:

## 10. Java program for swapping two numbers.

A prime number is a number that is greater than 1 and is divided by 1 or by itself alone. In other words, prime numbers cannot be divided by numbers other than themselves or 1. For instance 2, 3, 5, 7, 11, 13, 17. These are the prime numbers.

Let’s see the basic Java programming to find the prime number.

When you run the above code, the output appears as shown below:

## CONCLUSION

In this article, we explored 10 Java programs examples with output for you to learn and practice. There are several other basic Java programming for you to explore. To witness this journey to the greatest extent, the Master Certificate In Full Stack Development offered by Jigsaw Academy is perfect for you. This  170-hour online instructor-led program extensively covers Full Stack Development with Automation and AWS Cloud.

Ajay Sarangam

Ajay Sarangam

## Books on Analytics

Analytics is a vast field. At the one end, it overlaps with statistics and higher…

## Career in analytics in a KPO

Do you love to explore and investigate information? Do you find spreadsheets to be a…

## Indian companies using analytics

India has developed into the global hub for analytics. A large number of MNCs have…

## IBM: Betting big on analytics

International Business Machines Corp. Or IBM as it is popularly known recently announced its restructuring…

## How to build a successful career in analytics

So you have got a job as an analyst in your dream company? Here are…

## What’s the sentiment on “sentiment analysis”?

What's the sentiment on "sentiment analysis"? Is the field ready to take off?