because usage of pointer leads illegal access of data i.e pointers show the exact address of the data and using this address any modifications can be made to info stored leading to lack of security, but java is a secured language and prides itself of being robust thats the reason pointers concept was removed from java.
though there are refference variables in java which act in a similar ways like pointer that is holding the address of an object
for example consider
class A {
} class B { A a= new A();
}
here 'a' is a refference variable which stores the address of the object A and the address is not revealed to the user or any other because if u try to access the address of 'a' it returns a fully qualified address i.e. packagename.classname@some hexadecimal value by doing so the security is preserved and illegal access is avoided
Most of the pointer related manipulation is done implicitly by the JVM and only references are used by the program. This is in order to abstract the memory from the overall application program in order to keep it safe from corruption, insecure access, etc memory related problems.
Java does not support pointers like C or C++ because it is designed to be secure and simple. Instead of pointers, Java uses references to access objects. These references work like pointers but do not allow direct memory access. This helps prevent memory leaks, makes the code safer, and allows Java to handle memory management automatically using garbage collection.
No, Java does not support pointers like C or C++. Java manages memory automatically through its garbage collector, ensuring better security and stability. Instead of pointers, Java uses references to access objects, which prevents direct memory access and helps avoid common bugs such as memory leaks or pointer arithmetic errors.