File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Array Conversions

 
Saket Barve
Ranch Hand
Posts: 229
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is a question from DanChisholm's single topic exams. Can someone tell me why the line number 5 does not throw a NullPointerException?
We know that c is null and are trying to cast a null into an array of integers. How can that be?

Thanks,
Saket
 
giang nguyen
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Saket Barve:
Here is a question from DanChisholm's single topic exams. Can someone tell me why the line number 5 does not throw a NullPointerException?
We know that c is null and are trying to cast a null into an array of integers. How can that be?

Thanks,
Saket

Null pointer exeption is only thrown when you try to access a member variable or call a method on a null object.
Java allows you to cast a null object to any type, although it's still a null after casting.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic