Advertisement
|
public class PlaneSeatMain
{
public static void main(String[] args)
{
char[][] seat =
{
{'X', '*', '*', '*', '*', '*'},
{'*', 'X', '*', '*', '*', '*'},
{'*', 'X', '*', '*', '*', '*'},
{'*', '*', '*', '*', '*', '*'},
{'*', '*', '*', '*', '*', '*'},
{'*', '*', '*', '*', '*', '*'},
{'*', '*', 'X', '*', '*', '*'},
{'*', '*', '*', '*', '*', '*'},
{'*', '*', '*', 'X', '*', '*'},
{'*', '*', '*', '*', '*', '*'},
{'*', '*', '*', '*', '*', '*'},
{'*', '*', '*', '*', '*', '*'},
{'*', '*', '*', '*', '*', '*'},
};
System.out.println("seat 0,0: " + seat[0][0]);
System.out.println("seat 2,4: " + seat[2][4]);
}
}
I want to change values of seat as:
char[][] seat =
{
{'X', '*', '*', '*', '*', '*'},
{'*', 'X', '*', '*', '*', '*'},
{'*', 'X', '*', '*', '*', '*'},
{'*', '*', '*', '*', '*', '*'},
{'*', '*', '*', '*', '*', '*'},
{'*', '*', '*', '*', '*', '*'},
{'*', '*', 'X', '*', '*', '*'},
{'*', '*', '*', '*', '*', '*'},
{'*', '*', '*', 'X', '*', '*'},
{'*', '*', '*', '*', '*', '*'},
{'*', '*', '*', '*', '*', '*'},
{'*', '*', '*', '*', '*', '*'},
{'*', '*', '*', '*', '*', '*'},
};
but after using
char[][] seat =
{
...
};
the compiler gives error if I use it again to change the values, because:
"seat is already defined in main(java.lang.String[])"