hi,
when I execute following code, I get the java.lang.NullP ointerException
try
{
int cnt=0;
for(int i=0;i<d;i++)
{
String s = dpos[i];
String s1 = dpos1[i];
String s2 = dpos2[i];
String s3 = dpos3[i];
if(s.equals("C" ) || s1.equals("C") || s2.equals("C") || s3.equals("C"))
{
cnt++;
cfn[i] = dfn[i];
cln[i] = dln[i];
cpos[i] = dpos[i];
chr[i] = dhr[i];
crbi[i] = drbi[i];
csb[i] = dsb[i];
cavg[i] = davg[i];
cvalue[i] = dvalue[i];
}
}
for(int c=0;c<cnt;c++)
{
System.out.prin tln("Selected Players for C Position are:"+cfn[c]+" "+cln[c]);
}
}
catch(Exception e)
{
System.out.prin tln("Exception is....."+e);
}
but when I execute above code by making change in only if condition like
if(s.equals("C" ) )
it works well.But I want to check for all four string.
What mistake is here due to which I get the above exception.
Thanks,
Vikas Sawant.
when I execute following code, I get the java.lang.NullP ointerException
try
{
int cnt=0;
for(int i=0;i<d;i++)
{
String s = dpos[i];
String s1 = dpos1[i];
String s2 = dpos2[i];
String s3 = dpos3[i];
if(s.equals("C" ) || s1.equals("C") || s2.equals("C") || s3.equals("C"))
{
cnt++;
cfn[i] = dfn[i];
cln[i] = dln[i];
cpos[i] = dpos[i];
chr[i] = dhr[i];
crbi[i] = drbi[i];
csb[i] = dsb[i];
cavg[i] = davg[i];
cvalue[i] = dvalue[i];
}
}
for(int c=0;c<cnt;c++)
{
System.out.prin tln("Selected Players for C Position are:"+cfn[c]+" "+cln[c]);
}
}
catch(Exception e)
{
System.out.prin tln("Exception is....."+e);
}
but when I execute above code by making change in only if condition like
if(s.equals("C" ) )
it works well.But I want to check for all four string.
What mistake is here due to which I get the above exception.
Thanks,
Vikas Sawant.
Comment