Results 1 to 7 of 7
  1. #1
    edelric666 is offline Member
    Join Date
    Oct 2010
    Posts
    12
    Rep Power
    0

    Question what does it mean "pass an argument to a method"

    Hi i have been following some online instructions to write a few java programs and the thing says "pass an arguement to a method" what does this actually mean? and how does one go about doing so?

    thanks for any help

    edelric666

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Some methods have parameters and when you call these methods you must pass arguments into the parameters. That's all it means.

    For example, one overload of the System.out.println method has a String parameter, and below, I'm passing the method the argument "hello world":
    Java Code:
    System.out.println("hello world");

  3. #3
    edelric666 is offline Member
    Join Date
    Oct 2010
    Posts
    12
    Rep Power
    0

    Default

    thank you, can i ask where you got the example from? because most places i have seen use the "hello world" example and it would be great to find out where this is from.

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by edelric666 View Post
    thank you, can i ask where you got the example from?
    From a deep recess in my brain. You don't want to go there. Trust me.


    ...because most places i have seen use the "hello world" example and it would be great to find out where this is from.
    That's an interesting question as "hello world" has been a tradition of programming for as long as I remember, predating Java and quite possibly C. It ranks right up there with foo and bar.

    edit: no, it does not pre-date C but in fact may have been first seen or at least popularized in an example in one of the first seminal books on C: http://en.wikipedia.org/wiki/Hello_world
    Last edited by Fubarable; 10-30-2010 at 08:59 PM.

  5. #5
    joshdgreen's Avatar
    joshdgreen is offline Senior Member
    Join Date
    Oct 2010
    Location
    Colorado Springs, CO
    Posts
    212
    Rep Power
    4

  6. #6
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default

    Quote Originally Posted by Fubarable View Post
    one of the first seminal books on C

    "one of"? Heresy!

    The comparatively few pages of K&R's bible remains a model of clarity in a world where the likes of Herbert Schildt have laid waste to whole forests. Anyone new to Java would do well to obtain a copy and read it by way of a change.

    Also OP: You now have 2 threads on this. Perhaps you could consider consolidating them into one? Post a link from one to the other.

  7. #7
    edelric666 is offline Member
    Join Date
    Oct 2010
    Posts
    12
    Rep Power
    0

    Default

    no problem i will do it now, and thanks for your help everyone.

Similar Threads

  1. Replies: 3
    Last Post: 10-12-2010, 04:21 PM
  2. pass "." as a string
    By billq in forum New To Java
    Replies: 5
    Last Post: 02-07-2010, 05:39 AM
  3. problem with argument list and precedence "(" and ")"
    By helpisontheway in forum Advanced Java
    Replies: 6
    Last Post: 12-24-2009, 07:50 AM
  4. Replies: 2
    Last Post: 01-24-2009, 06:56 PM
  5. Replies: 1
    Last Post: 10-20-2008, 07:35 AM

Tags for this Thread

Posting Permissions

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