//Program to display prime numbers between 2 range using command line argument
class prime
{
public static void main(String args[])
{
if(args.length!=2)
{
System.out.println("Enter both starting & ending limit, only 2");
System.exit(0);
}
int num=Integer.parseInt(args[0]);
int num1=Integer.parseInt(args[0]);
int count;
if (count<=1)
{
System.out.println("Prime numbers starts from 2");
System.exit(0);
}
for(int i=num; i<num1; i++)
{
count=0;
for(int j=2;j<=i/2;j++)
{
count++;
break;
}
if(count==0)
System.out.print(i);
}
}
}
This is the error:
javac prime.java
prime.java:15: error: variable count might not have been initialized
if (count<=1)
But I have initialised it already. Any help? I am new to SO