+ 4
why does java does not support pointers
pointer
5 Respostas
+ 14
Java is a platform independent, managed language. The Java Virtual Machine (JVM) does the memory management, so you needn't handle the memory.
+ 4
yes there is no direct running of code all code interacts with JVM and JVM automatically does pointer operations wherever needed it also requests constructs destructs for memory mangement
+ 4
if java will support pointers then direct access to adress would be possible.. and by this way..hacking can be done easily.. it will give java a disadvantage :lack of security.
+ 3
There are some hacky tool included in Java, so you can do similar stuff, like allocate bytes, and cast them to be a certain object of a type. These unsafe stuff included in the mysterious sun.misc.* package, and highly NOT RECOMMENDED to use. Java developers (I mean Oracle) use the package for themselves, but professional programmers started to use it in special cases. Oracle dislikes this, and wished to remove the utility, then the community answered like "Hell, NO!"
It is really a complex question, because Java is said to be one of the safest programming languages, and so, the manual use of pointers is - as all if us know - can be dangerous, allocating memory (and freeing it) "by hand" is the main reason of that.
You can read more on the current situation here:
https://adtmag.com/blogs/watersworks/2015/08/java-9-hack.aspx?m=1
( Same as answered on this thread:
https://www.sololearn.com/Discuss/376559/?ref=app )
+ 2
Most studies agree that pointers are one of the primary features that enable developers to inject bugs into their code. When Java was created, the intention was to create a language that is easy to learn and not prone to the bugs that C++ is prone to. It's not like c/c++ where we have to manage the memory management by destructors. In java automatic Garbage Collector works for memory management. Actually, Java references are pointers so everything in Java is accessed only through pointers.
Some reasons for Java does not support Pointers.....
http://net-informations.com/java/cjava/pointers.htm
Dell