Hi Guys, Was asked this quesion by my lecturer(& was left speechless ) Heres' the question...
SUGGEST A WAY BY WHICH POINTERS CAN BE IMPLEMENTED IN Java...!!
The question expects a suggestion that has a mechenism that shows pointers being implemented logically in java code... I have heard that it can be done using interfaces, not sure if its true though...!!
Can anyone sugest the solution...??
If your new Big Idea doesn't scare the hell out of you, <br />it's probably not a "new Big Idea".
Your teacher is asking you to read his/her mind to determine his/her definition of "pointer", which almost certainly does not align with any of the 'de facto' definitions, since I can't think of any reasonable one, even one that I don't entirely agree with, that would allow your question to be correctly answered.
Good luck, I recommend the Stealth Max V2 Crystal Ball "rub and be enlightened". I use it at work quite successfully.
All variables that refer to objects in Java are pointers. We generally like to say "references" instead, but they're pointers just the same. The only difference between Java pointers and C pointers is that you can't do "pointer arithmetic" in Java -- you can't subtract pointers, or convert to and from integers. But a Java variable points to an object in just the same way that a C pointer does; it can be reassigned to point to another object, or set to null (no object).
So if you know what a linked list is, and how to implement one in C/C++, then just do it the same way in Java.