Find the first thousand prime numbers


Discuss the below:

Q: Create a Java program that meets the following requirements:

Declare a method to determine whether an integer is a prime number

Use the following method declarations:

public static Boolean isPrime (int num)

An integer greater than 1 is a prime number if its only divisor is 1 or itself. For example, isPrime (11) returns true, and isPrime (9) returns false.

I have to use the isPrime method to find the first thousand prime numbers and display every ten prime numbers in a row, as follows:

2 3 5 7 11 13 17 19 23 29
31 37 41 43 47 53 59 61 67 61
73 79 83 89 97 ...
...
The input and output must use JOptionPane dialog and display boxes.

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Find the first thousand prime numbers
Reference No:- TGS01935082

Now Priced at $20 (50% Discount)

Recommended (90%)

Rated (4.3/5)