Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java in General
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Java in General
Why not getting Initialized
Shaan Shar
Ranch Hand
Posts: 1252
I like...
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I have wrote a program below but it is giving a astonishing result: now why it is so:
[B]Class Test{ public static void main(String args[]){ Test t = null; init(t); System.out.println(t); } public static void init(Test t){ t = new Test(); } }[/B]
It is not giving a
string
representation of
Test
Object
It is giving null in System.out.println().
Why it is giving so.............???
Ulf Dittmer
Rancher
Posts: 43081
77
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I think it will become clear if you read up on the concept of
call-by-value vs. call-by-reference
.
Henry Wong
author
Posts: 23951
142
I like...
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
This
Javaranch FAQ
explains what you are encountering.
Henry
Books:
Java Threads, 3rd Edition
,
Jini in a Nutshell
, and
Java Gems (contributor)
Shaan Shar
Ranch Hand
Posts: 1252
I like...
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Thankx a lot for such a quick reply...
Now I got to know that why this was showing such a behaviour.....
Consider Paul's
rocket mass heater
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Stack overflow exception
please tell me how this code works.
Doubt-Khalid Mock Test,Q.No 14
overloading
solve this
More...