Auf Thema antworten

Heyho , ich habe mal wieder ein Problem,

und zwar soll ich die Zeilen eines Arrays genau ansprechen -


[code=Java]import java.util.Arrays;


import javax.swing.JOptionPane;

public class fillArray02

{

 

    static int[] testFeld = new int[5];

    static int a, x, y, z;

    static String testString;

    static int h = 1;

    static int[] fillArray( int size, int min, int step )

    {

        int[] testFeld =

        {

            x

        };

         while (h<size){

            testFeld[0] = min + (step * 0);

            testFeld[1] = min + (step * 1);

            testFeld[2] = min + (step * 2);

            testFeld[3] = min + (step * 3);

            testFeld[4] = min + (step * 4);

            return testFeld;

         }

        }

      

   

 

    public static void main( String[] args )

    {

        x = Integer.parseInt( JOptionPane.showInputDialog( "size=" ) );

        y = Integer.parseInt( JOptionPane.showInputDialog( "min=" ) );

        z = Integer.parseInt( JOptionPane.showInputDialog( "step=" ) );

        testFeld = fillArray( x, y, z );

        System.out.print( Arrays.toString( testFeld ) );

    }

}[/code]


Und zwar soll das Array nicht nur 0-4 lang sein , sondern 0-size lang , und dieses will ich dann returnen & mit der main methode ausgeben lassen.



Oben