按从小到大的顺序输出满足条件的四位十进制数。
public class Main {
public static void main(String[] args) {
String a;
for (int i = 1000; i <=9999; i++) {
a=String.valueOf(i);
StringBuilder sb = new StringBuilder(a);
sb.reverse();
String b=new String(sb);
if(a.equals(b)) {
System.out.println(i);
}
}
}
}