日期:2014-05-20 浏览次数:20660 次
public class ArrayTest {
/**
* @param args
*/
public static void main(String[] args) {
Slide s1 = new Slide(new char[][]{{'a','b','c','d'},{'e','f','g','h'},{'i','j','k','l'},{'m','n','o','p'}});
Slide s2 = new Slide(new char[][]{{' ',' ','x',' '},{' ','x',' ',' '},{' ',' ' ,'x',' '},{' ','x',' ',' '}});
s1.project(s2);
for(char[] cells : s1.getCell()){
System.out.println(Arrays.toString(cells));
}
}
}
class Slide {
private char[][] cells;
public Slide() {
cells = new char[4][4];
}
public Slide(char[][] cells) {
for (int row = 0; row < cells.length; row++)
for (int column = 0; column < cells[row].length; column++)
this.cells = cells;
}
public void print() {
for (char[] a : cells) {
for (char c : a) {
System.out.print(c + " ");
}
System.out.println();
}
}
public void clear() {
for (char[] a : cells) {