• Post Reply Bookmark Topic Watch Topic
  • New Topic

Why not getting Initialized  RSS feed

 
Ranch Hand
Posts: 1249
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have wrote a program below but it is giving a astonishing result: now why it is so:




It is not giving a string representation of Test Object

It is giving null in System.out.println().

Why it is giving so.............???


 
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it will become clear if you read up on the concept of call-by-value vs. call-by-reference.
 
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This Javaranch FAQ explains what you are encountering.

Henry
 
Shaan Shar
Ranch Hand
Posts: 1249
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thankx a lot for such a quick reply...


Now I got to know that why this was showing such a behaviour.....


 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!