+ 5

Why does java doesn't support pointers?

If it doesn't support.. then why do other languages use them..

26th Dec 2016, 9:05 AM
Laxman Madipadige
Laxman Madipadige - avatar
9 Antworten
+ 11
for security reasons Java don't uses pointers in it . as it is easy to know the data by just knowing by the pushing a pointer which uses only address to retrieve the data. that's why it is easy to hack into the system containing c++ or c code . but not with Java ( so, Android OS is less open to viresus and attacks); I hope u got the answers; 😀
26th Dec 2016, 10:44 AM
shanky
shanky - avatar
+ 4
pointers may access illegal memory and since all demerits of C++ are avoided in java, Hence Java doesn't have pointers.
3rd Jan 2017, 6:45 AM
Sachin Artani
Sachin Artani - avatar
+ 2
Adding to other answers over here that maximum viruses are implemented through pointers only.. And java is absolutely fine without pointers ;)
3rd Jan 2017, 6:30 AM
Chirag Lathi
Chirag Lathi - avatar
+ 2
different languages are invented in different points in history, and by different people with different opinions on what should and what should not be in a language. so there are several reasons why languages differ: 1. different taste of the language architect. 2 . lessons learned from earlier languages. 3. different roles fit different languages. Java was designed by James Gosling who worked at Sun at the time. He developed Java out of c++ and removed some of the language features he thought were not good such as pointers and multiple inheritance. I am sure Bjarne Stroustrup would disagree, but that's why he is the c++ inventor and not the Java inventor :-) in addition, c/c++ are system languages and you can write an operating system in 100% C or C++, as having pointers and native code generation gives you absolute control over the bare metal, while Java aims to be a portable general purpose language that can run on any cpu /os - that's why it compiled to bytecode and runs via the JRM. you can't write an OS this way.
3rd Jan 2017, 10:02 PM
Udi Finkelstein
Udi Finkelstein - avatar
+ 1
I agree Mr.Shashankesh...but why only java neglects it..and not the other languages
26th Dec 2016, 10:47 AM
Laxman Madipadige
Laxman Madipadige - avatar
0
Why can't we use pointers in Java? Because the language designers chose not to include pointers in the language. Why we are not using the pointer here. Because the designers of Java thought it was a tricky-to-use and error prone construct. Which concept is used instead of pointer in Java? References (which are quite similar to pointers if you disregard from pointer arithmetic). Keep in mind that all objects you create, you create on the heap (using the new keyword). This fact, together with the fact that there is no "dereference operator" (* in C/C++) means that there's no way to get hold of an object! Since you can't get hold of an object, there's no way you can store an object in a variable. Therefor all variables (except the ones holding primitive types) are of reference-type. not my answer googled it
26th Dec 2016, 10:34 AM
Leonida17st
Leonida17st - avatar
0
in java object is reference has address for data
3rd Jan 2017, 10:08 AM
bouaabid
bouaabid - avatar
0
don't worry we have null pointer exception :D
3rd Jan 2017, 8:05 PM
Devendra Tiwari
Devendra Tiwari - avatar
0
In java we use the As references objects. The memory reservation is made during its instantiation and the release memory is performed automatically. This is done to facilitate management but it is better mastered memory in c ++ compared to java
3rd Jan 2017, 10:49 PM
bouaabid
bouaabid - avatar