奇怪的Java异常名称

奇怪的Java异常名称,java,exception,Java,Exception,我用一个空的对象执行了System.out.print,结果如下: 550270261027054028026002805302902590290520300258030051031025703105003202560320 490330255033048034025403404703502530350460360252036045037025103704403802500380 43039024903904204002480Exception 我试着用谷歌搜索,但是异常名称太长了 有人知道这

我用一个空的对象执行了System.out.print,结果如下:

550270261027054028026002805302902590290520300258030051031025703105003202560320
490330255033048034025403404703502530350460360252036045037025103704403802500380
43039024903904204002480Exception
我试着用谷歌搜索,但是异常名称太长了

有人知道这个例外意味着什么吗

for (int i = bulletList.size(); i > 0; i--) {
        final Bullet b = bulletList.get(i - 1);/* the bullet is just a class containing it's image, its position and its rectangle and handling its movement*/
        b.r = new Rectangle(b.x, b.y, 34, 20);
        for (i = obsticalList.size(); i > 0; i--) {
            final Obstical o = obsticalList.get(i - 1);//Obsical class is like the bullet class but for stationary thing
            System.out.print(o.r.x);
            System.out.print(b.r.x);//This is where I get the exception
        }

    }



3202452730245310255272025530026527102652902752700Exception in thread "Thread-3"
    at StartingClass.checkCollision(StartingClass.java:175)
    at StartingClass.run(StartingClass.java:107)
    at java.lang.Thread.run(Unknown Source)

obj=null的System.out.print(obj)只需打印word
null

数字不是异常名称的一部分。您的代码正在打印没有换行符的数字到标准输出

默认异常处理程序将堆栈跟踪打印到标准错误。来自标准输出和标准错误的消息在控制台上交错,因此您看到的数字来自代码,“异常”是堆栈跟踪的片段


最有可能的是,如果您在控制台中进一步回顾,您将看到异常名称的开头。如果
b
b.r
为空,则您指示的行可以引发的唯一运行时异常是
NullPointerException
;但是,考虑到您的代码,这似乎是不可能的。可能这个异常实际上是从另一行抛出的。行号和堆栈跟踪有助于确定这一点,但可能是前一行的
NullPointerException

你能发布你的代码和完整的堆栈跟踪吗?一般来说,这意味着你做了一个空的System.out.print。发布那段很棒的代码片段,它产生了这个奇妙的
异常
。你正在重用内部循环中的循环计数器
i
。这是故意的吗?您的外部循环将永远不会“循环”,因为这一点。@erickson重用可能最终导致
obsticalist.get(i-1)
抛出一些东西。