日期:2014-05-20  浏览次数:21032 次

报错“需要.class”!新手、求高手给解!
public static void main(String[] args)
{ String[] words={"hate","the","cat"};
int len=words.length;
select(words[]); //需要.class
System.out.println(words);
}

static void select(String[] lesswords)
{
int newlen=lesswords.getlength;
for(int i=0;i<newlen;i++)
{
String[] newwords=new String();
int k;
for(k=0;k<newlen;k++)
{
if(k!=i)
newwords[k]=lesswords[k];
}
System.out.print(lesswords[i]);
select(newwords[]); //需要.class
}
}

------解决方案--------------------
select(words[]);

要改为: select(words);