Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Trouble passing array in parameters

  1. #1
    Junior Member
    Join Date
    Sep 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Trouble passing array in parameters

    import java.util.Scanner;
     
    public class Popcreasetwo{
     
     
    public static void main(String []args) {
     
    Handlethat theOne=new Handlethat();
     
    Scanner in=new Scanner(System.in);
     
     
    System.out.println("Enter the data. ");
     
    int[] ary1 = new int[1000];
    int[] ary2 = new int[1000];
     
    for(int y=0; y < 50; y++){
    ary1[y]=in.nextInt();
    ary2[y]=in.nextInt();
     
    }
     
     
    theOne.theMethod(ary1,ary2);
    theOne.thePrintMethod(ary1, ary2);
     
     
     
     
     
    }//end of main method
     
     
    }// end of popcrease
     
    class Handlethat{
     
     
    public void theMethod(int [], int[]){
     
     
     
     
     
    }//end of the method
     
    public void thePrintMethod(int [], int[] ){
     
     
     
    }
     
    }// end of class handlethat


  2. #2
    Member
    Join Date
    Sep 2011
    Location
    United States
    Posts
    30
    My Mood
    Fine
    Thanks
    0
    Thanked 6 Times in 5 Posts

    Default Re: Trouble passing array in parameters

    Hello AngryCrow,

    Before getting to the problem of this code, there are some posting good-practices you will want to consider:

    1. If you are going to post code put it between the [CODE ][/CODE] tags (minus the space in [CODE ]). As this will help to see how the code is formatted and possible problems.

    2. Include an actual question in your post along with any errors you are receiving. Doing so will increase your chances of getting a concise answer.

    3. Include which IDE you are using just in case.

    Ok, that being said, I can tell you there will be an issue with both your theMethod() and thePrintMethod() methods as you have only declared a variable type in the parameters but no variable name. Other than that things look fine. Hope this helped.

  3. The Following User Says Thank You to SerratedMind For This Useful Post:

    JavaPF (September 12th, 2011)

  4. #3
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 287 Times in 225 Posts
    Blog Entries
    4

    Default Re: Trouble passing array in parameters

    I have added highlight tags for you. We like to use these instead of code tags.
    Also, please make sure you post in the correct forum.
    Your thread is about Arrays, so it goes in the Collections & Generics forum.

    Another big mistake.. no description of your problem within your thread!
    Give us as much information as possible.
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

    Looking for a Java job? Visit - Java Programming Careers

Similar Threads

  1. Java help, passing/filtering a array
    By jack55655 in forum Collections and Generics
    Replies: 21
    Last Post: September 3rd, 2011, 11:43 AM
  2. passing a string and int array into a static method
    By u-will-neva-no in forum Java Theory & Questions
    Replies: 2
    Last Post: May 8th, 2011, 05:35 PM
  3. HELP. Passing Array to class.
    By videodrome in forum What's Wrong With My Code?
    Replies: 5
    Last Post: December 13th, 2010, 03:35 AM
  4. [SOLVED] array trouble
    By littlefuzed in forum What's Wrong With My Code?
    Replies: 3
    Last Post: October 13th, 2010, 08:56 PM
  5. New to vectors passing parameters
    By osmaavenro in forum What's Wrong With My Code?
    Replies: 3
    Last Post: September 30th, 2010, 04:32 PM