Memory access via pointer arithmetic - this is fundamentally unsafe. Java has a robust security model and disallows pointer arithmetic for this reason.
Java does have reference to objects, it just doesn't call them pointers. Any normal object reference works like a pointer would.
Java was created to be portable and easy to develop. Pointers are dangerous if you don't know what you are doing. Since they never claimed to be a language for fast performance programs, they hid the concept of pointers under a layer of abstraction.
Java is platform independent. So if we use pointers the address of the variable varies in different machines. Thus using pointers becomes invalid and provides different result in different machine. Also java provides security without the use of pointers.
For security purpose pointers are not in java. As if there would be pointers then accessing main memory becomes easier( as pointers points to the main memory) for hackers and they could hack important information.
for memory management and also due to the security concerns... pointers let programs to access the memory directly and change the contents of the memory... the memory accessed here can be used by other process.. that may cause serious damage to that process
@Piyush Manglani, your explanation is misleading. Pointers are very good for performance and to save memory if you know what you are doing. They are a very powerful tool. C++ expects the programmer to know what they are doing, while Java expects them to be prone to mistakes.
I was just pointing out that the reason is not to save memory from empty pointers, because Java still uses the same memory from pointers, but with extra memory and processing to hide them from programmers. All variables, are deallocated manually or when they go out of scope, but Java often uses more memory because programmers don't control when that deallocation is done.
java has no pointers to prevent memory leak.
explaing the concept :
have anybody heard about the linked list in c++
what us the function of linked list it is used to save address of the next no. and there are types of linked list i am not mentioning them here.lets come to point when a linked list is used and is not in use any more the pointers which were used to allocate memory address become empty and this waste of memory.to prevent this memory waste pointers are not used in java and also for some security reasons pointers are not used.
i hope it helps.
sorry if i offended you but i was talking about java.
i told why java dont have pointers.java uses refrence variables by using keyword NEW and java also had pointers but not implicit pointers. i am not misleading just sharing what i know and i do know what i am doing and yes c++ is a powerful language. thank you for correcting me denis, appreciate it .