Write a java application that reads a number from the keyboard and check that it is Prime or not(File must be save as: Prime01.java)

import javax.swing.JOptionPane;
class Prime01
{
            public static void main(String args[])
            {
                        String s;
                        double n;
                        int i,p=0,a,c;
                        s=JOptionPane.showInputDialog("Enter any number: ");
                        a=Integer.parseInt(s);
                        n=Math.sqrt(a);
                        c=(int)n;
                        if(a<2)
                        JOptionPane.showMessageDialog(null,"The number is not prime.");
                        else
                        {
                                    for(i=2;i<=c;i++)
                                    {
                                                if(a%i==0)
                                                p++;
                                    }

                                    if(p>0)
                                    JOptionPane.showMessageDialog(null,"The number is not prime.");
                                    else
                                    JOptionPane.showMessageDialog(null,"The number is prime.");
                        }
                        System.exit(0);
            }
}


////////////////////////////////////////////
Copy & paste this code in your TextPad & run, then you will get output.......
If you have any problem please comment below.........