Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

a real beginers question

 
Surya Renduchintala
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey folks!
how does java handle pointers. i know that java as such does nt have pointers but it creates the references and objects right. i am totally confused on these references can some one help me in explainin me.
thanks in advance ......
 
Richard Boren
Ranch Hand
Posts: 233
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Surya,
A really good starting place is at The Campfire's Story Pass-by-value Please.
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Basically all variables of type Object are actually pointers to an Object.
So with
String s = "Java";
s is actualy a pointer pointing to the location of the String.
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
AHA Thomas!! Caught ya!
You KNOW that it says in the fine print of the JLS
[non-quote]
Thou shalt NOT use the word pointer as a synonym for a reference in JAVA.
[end-non-quote]
Even though a variable holds an address or reference to the location of an object in java, it does not have the same ability to be manipulated the way a pointer in c does. Therefore it is dangerous to use the word pointer in any context in java.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic