Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Null pointer Exception  RSS feed

 
shailesh thakur
Greenhorn
Posts: 15
Eclipse IDE MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
As far as i know java doesn't have pointers, then why do we have null pointer exception in java.
If we have no pointers in java then the name of the exception should be Null reference exception.
 
Avery Torres
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure where you are getting your info from but here are some links that might help you out. They explain pointers and their function in the java language better than I could.

http://cslibrary.stanford.edu/106/
http://www.sourcecodesworld.com/articles/c/pointers-and-memory/java.asp

Check those out and maybe other questions will arise after reading.
 
Henry Wong
author
Sheriff
Posts: 23283
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
shailesh thakur wrote:Hi,
As far as i know java doesn't have pointers, then why do we have null pointer exception in java.
If we have no pointers in java then the name of the exception should be Null reference exception.


Agreed... but since this has been this way since before Java 1.0, I think we can also conclude that way too many things will break, if the name gets changed now.

Henry
 
Campbell Ritchie
Marshal
Posts: 55672
161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In which case you would have to change the name of the corresponding exception in C#, too
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!