public class Test{
public static void main(String[] args) {
int a=9527;
for(int count = 0;count<4;count++){
int n=a % 10;
a=a/10;
System.out.println(n);
}
}
}
输出结果为:7 2 5 9
public class Test{
public static void main(String[] args) {
int a=9527;
print(a);
}
//递归
public static void print(int a){
if(a>9){
print(a/10);
}
System.out.println(a % 10 +"");
}
}
输出结果为9 5 2 7