+ 4

Does java support pointers? If No why?

1st Aug 2018, 10:54 AM
RahimUnnisa Khan
RahimUnnisa Khan - avatar
2 Antworten
+ 4
ive not encountered pointers as of yet but im reading some c++ so i know what you mean, as a matter of fact i am 11 chapters in a college book on java and have not seen any references to addresses at all while in my c++ book it was extensively covered. ill look into it some more but my guess is that pointers are made irrelevant because in java you primarily use objects which are passed by reference and the primitive data we use is primarily stored within some object or another update: no java does not allow pointers and why is because objects are passed by reference and as a security measure. in the C language its possible with bad programming to access portions of memory that you shouldnt using pointers and that can cause bad things to happen in the wrong hands, without proper safe guarding on the programmer side, in java they also excluded them so the garbage collector could do its job i guess pointers would cause issues with the automatic collection.
1st Aug 2018, 11:33 AM
StealthyTaco
StealthyTaco - avatar
+ 2
Thank you So much....
3rd Aug 2018, 5:40 AM
RahimUnnisa Khan
RahimUnnisa Khan - avatar