| Author |
reading method signature
|
Abhijeet Sutar
Greenhorn
Joined: Feb 28, 2010
Posts: 17
|
|
How do I read this ?
though i try to read like this-
1> Method meth is taking Test class reference and retuning String class reference
2> Method meth is taking Test class object and returning String object
Just any one tell me which one correct or some other way to read
|
OCPJP 6 93%
|
 |
Mohamed Sanaulla
Bartender
Joined: Sep 08, 2007
Posts: 2926
|
|
Abhijeet, Welcome to JavaRanch.
In java- Objects are not passed between the methods- Instead- The references, which point/refer to these objects are being passed to the method/returned from the methods. So the first version is correct (but with Strings you need to be a bit more clear)
|
Mohamed Sanaulla | My Blog
|
 |
Abhijeet Sutar
Greenhorn
Joined: Feb 28, 2010
Posts: 17
|
|
okay Thank you ,
But Not understood this?
Mohamed Sanaulla wrote:(but with Strings you need to be a bit more clear)
can you elaborate please ..
|
 |
Seetharaman Venkatasamy
Ranch Hand
Joined: Jan 28, 2008
Posts: 5575
|
|
Mohamed Sanaulla wrote:
In java- Objects are not passed between the methods- Instead- The references, which point/refer to these objects are being passed to the method/returned from the methods.
fine with one small change that The reference *copy*, which point/refer to these objects are being passed as a method argument.
@Abhijeet: to read a method signature in a class, you can go for reflection api.
|
 |
Mohamed Sanaulla
Bartender
Joined: Sep 08, 2007
Posts: 2926
|
|
Abhijeet Sutar wrote:
Mohamed Sanaulla wrote:(but with Strings you need to be a bit more clear)
can you elaborate please ..
You could read this: The SCJP Tip Line, Strings, Literally. You have String objects and String literals.
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
Moving to Beginning Java.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
 |
|
|
subject: reading method signature
|
|
|