2013-05-03 84 views
0

我做了一個帶是System.out.print這是一個空對象,我得到這個:奇怪的Java異常名稱

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) 
+3

你可以發佈你的代碼和完整的堆棧跟蹤嗎? – Antimony 2013-05-03 04:07:46

+0

通常,這意味着您對null執行了System.out.print。 – 2013-05-03 04:08:06

+7

發佈** awesome **代碼片段,它給了這個**奇妙的**'Exception'。 – SudoRahul 2013-05-03 04:08:18

回答

5

數字不是例外名稱的一部分。你的代碼是打印數字,沒有換行到標準輸出。

默認異常處理程序將堆棧跟蹤打印到標準錯誤。來自標準輸出和標準錯誤的消息正在您的控制檯上交錯顯示,因此您看到的數字來自您的代碼,而「Exception」是堆棧跟蹤的片段。

最有可能的是,如果您在控制檯中進一步回顧,您會看到異常名稱的開頭。如果bb.r爲空,那麼您指出的行可能拋出的唯一運行時異常爲NullPointerException;但是,鑑於你的代碼,它看起來不是這樣。也許這個例外實際上是從另一行中拋出的。行號和堆棧跟蹤可以幫助將其鎖定,但可能是前一行的NullPointerException

2

帶有obj = null的System.out.print(obj)將簡單打印word null