java和null异常以及for循环和字符数组

时间:2015-10-03 05:17:29

标签: java

我是java新手,这是我的第二季度课程。但我不明白如何修复此null异常。我可以完成我的程序,但它只是在烦我为什么我无法编译它输入代码

    Character letter = null;
    String[] boy_Names = null;
    String randName = null;
    Character[] strConvert2Char = null;
    String names = boyNames(boy_Names, randName);
    String[] name = null;
    Character[] charChar = convertString2Char(names, strConvert2Char);
    char cC = Character.toLowerCase(checkChar[j]);

    String emptyUnderscores = null;
    int underscoreLength = boyNames(name, emptyUnderscores).length();
    Character[] checkChar = new Character[underscoreLength];

    System.out.println("Character[underscoreLength]" + underscoreLength);


    System.out.println("\n\nPlease Guess a Letter: ");
    String[][] hangmanMenu = null;
    Scanner inputStream = new Scanner(System.in);
    for (int i = 0; i < 25; ++i) {
        for (int j = 0; j < 25;) {
            System.out.println("checkChar" + checkChar[j]);
            Character nextChar = inputStream.next().charAt(i);
            char nC = Character.toLowerCase(nextChar); 
            char cC = Character.toLowerCase(checkChar[j]);

            if (nC == cC == true) {
                System.out.println("TRUE" + "j: " + j);

                j = j + 1;
            } else {
                if (Character.toLowerCase(nextChar) == Character.toLowerCase(checkChar[j]) == false)
                    j = j + 0;
                System.out.println("FALSE" + "j: " + j);

            }


        }
    }

我好像在checkChar上运行null异常[j];

任何关于此的帮助或信息都会有所帮助!我调试了它,我似乎运行null,如果有人可以帮助运行更好的语法比较两个字符等于false或true通过for循环,这将帮助我很多!

0 个答案:

没有答案