我如何编译此程序?

问题描述 投票:-2回答:1

我在编译该程序时遇到问题,我不知道如何解决此问题

class ArrayTester{

    public void arrayTester(ArrayDeque arrayDeque) {

        List evenlist = new ArrayList();
        List oddlist = new ArrayList();

        for (int n = 0; n < arrayDeque.size(); n++) {

            if (arrayDeque.Length() % 2 == 0) {
                arrayDeque.addAll(evenlist);
            } else {
                arrayDeque.addAll(oddlist);
            }

            System.out.println(evenlist);
            System.out.println(oddlist);
        }
    }
}

class Kodilla {
    public static void main(String[] args) {

        ArrayDeque<String> arrayDeque = new ArrayDeque<>();
        Random random = new Random();
        String text = "";
        int howLong = random.nextInt(50) + 1;
        while (text.length() < howLong) {
            text = text + "a";
            for (int i = 0; i < 50; i++) {
                arrayDeque.add(text);
                System.out.println(arrayDeque);
                System.out.println(arrayDeque.size());

                arrayTester tester = new ArrayTester();
                tester.arrayTester(arrayDeque);
                System.out.println(arrayTester);
            }
        }
    }
}
java deque
1个回答
0
投票

我看到的是这一行arrayTester tester = new ArrayTester();变量定义中有错字。 (小写a)

© www.soinside.com 2019 - 2024. All rights reserved.