Java求数组解决方法~

P5705 【深基2.例7】数字反转

LovekfCandy @ 2021-11-01 23:07:31


public class Main {
    public static void main(String[] args) {
        Scanner src=new Scanner(System.in);
        char[] c=new char[6];

        for(int i=0; i<c.length-1; i++)
        c[i] =src.next().charAt(0);
        for(int i=c.length-1; i>=0; i--) {
            System.out.println(c[i]);
        }

    }

}

by ud2_ @ 2021-11-01 23:46:07

先弄清楚 Scanner.next() 返回什么。


|