Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

What is pointer and does java support pointer? Give reasons.

user-image
Question ajoutée par Maryam Albalushi
Date de publication: 2015/12/03
mohd waseem waseem
par mohd waseem waseem , game developer , rex info technology

Pointer  is the variable which hold the address of the another variable in memory or it points to location of the variable in memory. In Java ,pointer is deprecated because of memory leak (misusing it like stack overflow)  by overwriting the address which cause compromise your system.

Zeeshan Latif
par Zeeshan Latif , Principal Embedded Systems Engineer , BlueEast-Orient Group of Companies

Pointer is basically holds address of variable in memory.

Ali Alawieh
par Ali Alawieh , Software Engineer (Android) , CME Offshore S.A.L

A pointer is a value that points to an address in memory .

 

Like for example : int *x = fcd8; // would point to  fcd8 address in the memory.

All languages use pointers , it doesn't have to be explicit .But the main reason for languages like Java to "hide them" is to simplify the programmers life.But other reasons could be security , not just protecting programs from hackers , but from the programmer himself. Things can go horribly wrong if you mess up using pointers. You could overwrite data you shouldn't be by simply doing x[ ] =0 in C++ where *( x ) is something you shouldn't be accessing.Try reading about buffer overflow attacks.

 

Also read about passing arguments to functions as parameters or addresses, might make things more clear for you.

 

 

 

More Questions Like This