WHY JAVA DOES NOT HAVE POINTERS ................................................................................................................. Well, it's debatable whether Java does or doesn't support pointers.Some would say that everything (well, every reference type) in Java is a pointer -- hence, the ever-familiar NullPointerException. But certainly, these reference types do not give one the sort of direct interaction with memory that we're familiar with from pointers in. Instead, all objects are handled by references, not to be confused with pointers or C++ references. The difference is that Java references do not refer directly to the memory location , but rather contain the pointer to the actual memory location, which the programmer cannot get direct access to. It is also true that pointers are dangerous and lead to memory leaks, memory corruption, invalid memory access, e.g. from uninitialized and improperly initialized variables, indexing out of bounds, a...
Comments
Post a Comment