• 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

Parameter passing in methods

 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In code journalOrderString is defined as a String type.
journalOrderString = JournalUtil.getRecordedJournalOrder(scriptName + ".tst");
It is calling getRecordedJournalOrder()method from another class;
public static String getRecordedJournalOrder(String scriptName)
But here it is taking only scriptName as arguement and not scriptName + ".tst";

Can anybody explain?
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
follow the links in this recent topic to discover your answer

https://coderanch.com/t/569326/java/java/when-arguments-parameters-return-exactly
 
Aggarwal Arpit
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Michael Dunn for your link.

But I want to know can we pass 2 values-(scriptName + ".tst");
to a method accepting only one argument -getRecordedJournalOrder(String scriptName),like we see in code.
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Arpit gmail wrote:Thanks Michael Dunn for your link.

But I want to know can we pass 2 values-(scriptName + ".tst");
to a method accepting only one argument -getRecordedJournalOrder(String scriptName),like we see in code.


Isn't it easier to try it out yourself? Did you? What happened? What do you think scriptName+".tst" evaluates to?
 
Aggarwal Arpit
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Maneesh Godbole wrote:

Arpit gmail wrote:Thanks Michael Dunn for your link
"Isn't it easier to try it out yourself? Did you? What happened? What do you think scriptName+".tst" evaluates to?"

It's working fine .But I want to know what does this mean scriptName+".tst"-It's appending .tst to scriptname?

 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
> But I want to know can we pass 2 values-(scriptName + ".tst");

is it 2 values?

simple demo



are 2 values printed?
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Recommended reading: String API, especially the part where it talks about concatenation
 
Aggarwal Arpit
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks,

I got the concept behind it:-)
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic