0
Why there is no pointer in Java?
Pointer is one of the important tool in C/C++ programing language. Also, Its very important in program optimization too. But, I read there is no pointer in Java, Why is that ?
2 Réponses
+ 3
Java have a robust security model , and using memory access via pointer it's not really safe.
(plus, you need a lot more memory for in-run time checks)
+ 2
Pointer arithmetic is unsafe, references are safer - especially during garbage collection - and Java is intended to be portable (architecture differences on pointer sizes).
Here's a nice discussion:
http://stackoverflow.com/a/2629758/3981745
There are exceptions but they break the JVM's mission.