Java Program to Print First 10 Prime Numbers

Added By: Prem Tiwari | Last Updated: | In: Java Programming


This is a very simple Java program to print first 10 prime numbers. If you are a Java beginners or want to start learning Java programming language, then this program will help you to understand the basic Java programming.

In this post, I will explain about a Java program to print first 10 prime numbers with an example and output.

Java Program to Print First 10 Prime Numbers

Before executing this program I assume you have configured Java in your computer. Copy the below program and create a file “PrimeNumberProgram.java” and execute it to print first 10 prime numbers.

First 10 prime numbers are:
2
3
5
7
11
13
17
19
23
29

Liked this tutorial? Do Like & share with your friends 🙂

Share this post!


About: Prem Tiwari

Prem Tiwari is the founder of FreeWebMentor.com and also a professional developer who has vast experience in PHP and open source technologies. Apart from this, he is a blogger by hobby and also he has been a regular speaker of WordPress sessions in various IT Companies.


Tags: , , , , , , ,