Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

reference vs pointers

  Asked By: Daryl    Date: Oct 22    Category: Java    Views: 606

i read in one of the books that java does not
implement pointers . i.e i would not be able to access
physical memory address.

But i read that java has an alternative called the
reference to access objects and variables.

what is the essential difference between a pointer
and a reference .



1 Answer Found

Answer #1    Answered By: Riley-jack Johnson     Answered On: Oct 22

A pointer is a memory  location that contains a reference  to a
variable. That's about it.

Java does not have pointers in the sense that you cannot declare them.
In another sense, every object in Java is a pointer and Java just lets
you treat it as if it were the actual object. You don't have to worry
about deleting the objects  due to garbage collection.

Didn't find what you were looking for? Find more on reference vs pointers Or get search suggestion and latest updates.