我尝试在没有任何 for 循环的情况下打印输入数字的反向。但是我在打印 Arraylist 时遇到了一些问题。如何将 Arraylist [3, 5, 4, 1] 打印为 3541 - 不带括号、逗号和空格?
如果不可能,如何将我的 ArrayList 元素添加到 stringlist 然后打印?
public static void main(String[] args) {
int yil, bolum = 0, kalan;
Scanner klavye = new Scanner(System.in);
ArrayList liste = new ArrayList();
//String listeStr = new String();
System.out.println("Yıl Girin: "); // enter the 1453
yil = klavye.nextInt();
do{ // process makes 1453 separate then write in the arraylist like that [3, 5, 4,1]
kalan = yil % 10;
liste.add(kalan);
bolum = yil / 10;
yil = bolum;
}while( bolum != 0 );
System.out.println("Sayının Tersi: " + ....); //reverse of the 1453
klavye.close();
}