arrays and method problems..

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jimgym1989
    New Member
    • Sep 2008
    • 30

    arrays and method problems..

    Code:
    /**
     * @(#)array.java
     *
     *
     * @author 
     * @version 1.00 2008/9/11
     */
    
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    
    public class array {
    	
    static Scanner console = new Scanner(System.in);
        public static void main(String[]args) 
        	{
        	int[][] inStock = new int[10][4];
        	int[] alpha = new int[20];
        	int[] beta = new int[20];
        	int[] gamma = {11,13,15,17};
        	int[] delta = {3,5,2,6,10,9,7,11,1,8};
        	
        	inputArray(int[] alpha);
        	}
        	
        	public static void inputArray (int[] a)
        	{
        		int index;
        		for(index = 0;index<a.length;index++)
        		{
        			
        	System.out.print("Enter 20 numbers: ");
        	a[index] = console.nextInt();
        	
        		}
        	}
        
        
    }
    //'.class' expected
    //')' expected

    //these are the errors
  • Ganon11
    Recognized Expert Specialist
    • Oct 2006
    • 3651

    #2
    Originally posted by jimgym1989
    Code:
        	inputArray(int[] alpha);
        	}
    This is not the correct way to call a method. alpha has already been declared, you don't need the 'int[]' in front of its name.

    Comment

    • samido
      New Member
      • Oct 2007
      • 52

      #3
      on line number 24 .... change

      inputArray(int[] alpha);

      to

      inputArray(alph a);

      Comment

      • r035198x
        MVP
        • Sep 2006
        • 13225

        #4
        Originally posted by Ganon11
        This is not the correct way to call a method. alpha has already been declared, you don't need the 'int[]' in front of its name.
        So the terrorists finally let you go?

        Comment

        • jimgym1989
          New Member
          • Sep 2008
          • 30

          #5
          Originally posted by r035198x
          So the terrorists finally let you go?
          tnx man!! i appreciate!!

          Comment

          • Nepomuk
            Recognized Expert Specialist
            • Aug 2007
            • 3111

            #6
            Originally posted by jimgym1989
            Originally posted by r035198x
            So the terrorists finally let you go?
            tnx man!! i appreciate!!
            ??? I don't think that's the response you wanted to quote, is it? (Although of course we're all glad that Ganon11 seems unharmed. ^^)

            Greetings,
            Nepomuk

            Comment

            • Ganon11
              Recognized Expert Specialist
              • Oct 2006
              • 3651

              #7
              Originally posted by r035198x
              So the terrorists finally let you go?
              No Jericho Missile for them.

              Comment

              Working...