Results 1 to 6 of 6
  1. #1
    ravian is offline Senior Member
    Join Date
    Nov 2007
    Posts
    115
    Rep Power
    0

    Default arugment/parameter

    I am confused about the terminologies. What is the difference between argument and parameters.

    Java Code:
    public float calculateSalaray(String empName, int deptId)
    {
    ...
    }
    empName and deptId are parameters or arguments?

  2. #2
    CaptainMorgan's Avatar
    CaptainMorgan is offline Moderator
    Join Date
    Dec 2007
    Location
    NewEngland, US
    Posts
    835
    Rep Power
    9

    Default

    They're often used interchangeably, but more technically a parameter is the thing used to define a method while an argument is the thing used in the call to a method. And in the case you pointed out, they would be parameters as opposed to when you actually call calculatSalary("Foo", 2134) with arguments.

    Hope this helps.
    Vote for the new slogan to our beloved Java Forums! (closes on September 4, 2008)
    Want to voice your opinion on your IDE/Editor of choice? Vote now!
    Got a little Capt'n in you? (drink responsibly)

  3. #3
    tim's Avatar
    tim
    tim is offline Senior Member
    Join Date
    Dec 2007
    Posts
    435
    Rep Power
    8

    Default

    Thank you CaptainMorgan. Just learned something! :D
    Eyes dwelling into the past are blind to what lies in the future. Step carefully.

  4. #4
    CaptainMorgan's Avatar
    CaptainMorgan is offline Moderator
    Join Date
    Dec 2007
    Location
    NewEngland, US
    Posts
    835
    Rep Power
    9

    Default

    Quote Originally Posted by tim View Post
    Thank you CaptainMorgan. Just learned something! :D
    Glad to be of service. ;)
    Vote for the new slogan to our beloved Java Forums! (closes on September 4, 2008)
    Want to voice your opinion on your IDE/Editor of choice? Vote now!
    Got a little Capt'n in you? (drink responsibly)

  5. #5
    rpwtdj's Avatar
    rpwtdj is offline Member
    Join Date
    Dec 2007
    Posts
    15
    Rep Power
    0

    Default

    Great help!
    Thank you CaptainMorgan.

  6. #6
    ravian is offline Senior Member
    Join Date
    Nov 2007
    Posts
    115
    Rep Power
    0

Similar Threads

  1. Input parameter of Main method
    By Java Tip in forum Java Tip
    Replies: 1
    Last Post: 07-12-2008, 07:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •