Results 1 to 2 of 2
  1. #1
    boys21 is offline Member
    Join Date
    May 2010
    Posts
    14
    Rep Power
    0

    Default Passing arrays to function

    hi,

    I have a problem with passing arrays to a method in another class.

    class new {

    public static int i,j;
    Integer [] x= new Integer (i);
    Integer [] y= new Integer (j);
    public void new( int i, int j, int [] x, int [] y) {
    this.i=i,
    this.j=j;
    //manupulation with array

    }



    public class sample {

    psvm () {

    int row1=10;
    int row2=20;

    Integer [] myRow1 = new Integer (row1);
    Intger [] myRow2 = new Integer (row2);

    // read values in to row1
    // read values into row2

    new acessNew = new (row1,row2, myRow1, myRow2); // error : Multiple markers at this line

    }

    }
    }


    Thanks in advance,

    br,
    boys21

  2. #2
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,755
    Rep Power
    7

    Default Re: Passing arrays to function

    In future you need to copy and paste your error messages as we don't read minds.

    You cannot call your class "new" as that is a reserved word in Java.

Similar Threads

  1. passing an entire file to a c++ function
    By P5music in forum New To Java
    Replies: 3
    Last Post: 10-01-2010, 04:49 PM
  2. Passing an Array index into a function?
    By dpedroia15 in forum New To Java
    Replies: 3
    Last Post: 06-01-2010, 07:51 PM
  3. Example for passing string to a function.?
    By mlibot in forum New To Java
    Replies: 1
    Last Post: 03-19-2010, 06:36 AM
  4. how use string array while passing to a function
    By sks9s9 in forum New To Java
    Replies: 2
    Last Post: 02-03-2009, 12:44 PM
  5. Passing a Vector object to a function
    By evapisces in forum New To Java
    Replies: 4
    Last Post: 09-27-2008, 03:18 AM

Posting Permissions

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