Monday, 15 December 2014

The Terrible Dangers of Autoboxing (Part 3)

Part 2 can be found here.


Please explain why the code throws a NullPointerException.

Output:
/opt/tools/java/jdk1.7.0_65/bin/java com.mrbear.autoboxing.Plot
0
3
3
Exception in thread "main" java.lang.NullPointerException
    at com.mrbear.autoboxing.Plot.getSurfaceArea(Plot.java:28)
    at com.mrbear.autoboxing.Plot.main(Plot.java:39)


Process finished with exit code 1
Also, please mention how to fix it.

((Solution))

No comments:

Post a Comment