Results 1 to 3 of 3
  1. #1
    ezkatz19 is offline Member
    Join Date
    Jan 2012
    Posts
    7
    Rep Power
    0

    Default Help with formal parameter, ArrayList

    I need to pass an ArrayList named Pairs through my method Encode.
    When I run try to compile the code without filling in the parameters, leaving it Encode(), it obviously gives me an error message, which reads:
    Encode(java.util.ArrayList) in [myprogram'sname] cannot be applied to ()

    How do I format Pairs so that it will correctly compile? I don't understand what it means by java.util.ArrayList; if I were, say, to need to put in a String, it would just read Encode(String), and I wouldn't have to write the variable type, just the name, but this won't work if I try Encode(Pairs)

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

    Default Re: Help with formal parameter, ArrayList

    Please show us your code and some context. Have you used ArrayLists at all yet? Also, please re-name your methods and variables so that they all begin with lower case letters. Only classes, interfaces and the like should begin with capital letters.

  3. #3
    ezkatz19 is offline Member
    Join Date
    Jan 2012
    Posts
    7
    Rep Power
    0

    Default Re: Help with formal parameter, ArrayList

    Never mind, I got it. And thanks for the tidbit about the capital letters
    Last edited by ezkatz19; 01-27-2012 at 07:17 AM.

Similar Threads

  1. Replies: 12
    Last Post: 07-07-2011, 09:49 PM
  2. Replies: 7
    Last Post: 11-22-2010, 02:26 PM
  3. Using ArrayList as a parameter
    By Crypts in forum New To Java
    Replies: 6
    Last Post: 05-13-2010, 07:56 AM
  4. Formal introduction
    By sbliss in forum Introductions
    Replies: 3
    Last Post: 03-21-2010, 09:40 PM
  5. Replies: 2
    Last Post: 04-21-2008, 12:43 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
  •