Solved
Doble array execution
Posted on 2004-04-27
I am trying to find the array that results from the execution of (3, 4, 21)
Where the code for the method that was given to me is:
public static int [] [] f(int n, int m, int value);
{
int [] [] x = new int [n] [m];
for (int i=0; i < x.lenght; i++)
for (int j = 0; j < x[i].lenght; j++)
x[i] [j] = value;
return x;
}
Down below you can find how tried to run it.... I am missing something but do not know what. Can someone help me with this? Thank you! J.Cisek - Java student.
public class SkillBuilder
{
int [] [] f(int n, int m, int value);
public static void main(String[] args)
{
int [][] x = new int [n] [m];
for (int i=0; i < x.lenght; i++)
for (int j = 0; j < x[i].lenght; j++)
x[i] [j] = value;
return x;
}
System.out.println( x (x(int n, int m, int value) ) );