请问这样编写对吗???
public class difNum { int x,y,z;
int flag;
public difNum()
{
for(x=10000;x<32000;x++)
{
int[]a={0,0,0,0,0,0,0,0,0,0,0};
flag=0;
x=x*x;
y=x;
while(x>0)
{
z=x%10;
if(a[z]==0)
{
a[z]=1;
x= (x/10);
flag++;
}
else
break;
}
}
if(x>=32000)
System.out.print("没有这样的数!");
else if(flag==9)
{
System.out.print(y);
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
new difNum(); }}
public class difNum { int x,y,z;
int flag;
public difNum()
{
for(x=10000;x<32000;x++)
{
int[]a={0,0,0,0,0,0,0,0,0,0,0};
flag=0;
x=x*x;
y=x;
while(x>0)
{
z=x%10;
if(a[z]==0)
{
a[z]=1;
x= (x/10);
flag++;
}
else
break;
}
}
if(x>=32000)
System.out.print("没有这样的数!");
else if(flag==9)
{
System.out.print(y);
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
new difNum(); }}
x= (x/10); 这里应该变成x= (int)(x/10)
public Test10()
{
for(x=10000;x<32000;x++)
{
int[]a={0,0,0,0,0,0,0,0,0,0,0};
int flag=0;
y=x*x;
//y=x;
while(y>0)
{
z=y%10;
if(a[z]==0)
{
a[z]=1;
y= (y/10);
flag++;
if(flag == 9)
System.out.println(x+"的平方"+x*x);
}
else
break;
}
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
new Test10(); }}