I don't know if I'm retarded or what but I can't for the life of me pass a 2 dimensional array into a method.
correct me if this is the wrong format:
the error I'm getting says '.class' expected. The method program compiles, the driver does not. Pls help D:
EDIT: google is surprisingly stupid when it comes to this shit.
EDIT2: figured it out, apparently, you don't include the brackets when passing an array?
correct me if this is the wrong format:
Code:
public class Driver
{
public static void main(String[] args)
{
char[][] hello ={{'x', 'o'}, {'o', 'x'}};
Prog call = new Prog();
call.displayArray(hello[][]);
}
}
Code:
public class Prog
{
public Prog()
{
System.out.println("sup?");
}
public void displayArray(char[][] hi)
{
for(int r=0; r<2; r++)
{
System.out.println();
for(int c=0; c<2; c++)
{
System.out.print(hi[r][c]);
}
}
}
}
EDIT: google is surprisingly stupid when it comes to this shit.
EDIT2: figured it out, apparently, you don't include the brackets when passing an array?










Comment