Prime Numbers write java code
Write a text-based program to repeatedly ask the user to enter anumber. The user can enter a number <= 0 to stop.
For each number entered by the user, create a new thread thatwill determine if the number is prime. The thread should print theresult when it completes.
One way to test your program is to enter in two very largeprimes. The program should ask for the second number before it’sdone calculating the first. For example, 275604547 and413158523.
Solution
import java.util.Scanner;class Prime extends Thread{ private int n; public Prime(int n){
OR
OR