Добавлен вывод заголовков таблицы в заданиях 1 и 2 ЛР2

This commit is contained in:
Victor 2013-10-04 17:01:43 +03:00
parent 3705ef1078
commit 44cb090e0e
2 changed files with 9 additions and 7 deletions

View File

@ -15,6 +15,7 @@ public class CompareArrays1D {
String[] b3 = Arrays.copyOf(a, a.length);
String[] b4 = {"1","2","3"};
System.out.print("b\t\t\tb==a\tb.equals(a)\tArrays.equals(a,b) deepEquals\t\tb[0]==a[0]");
printRow("b=a\t\t\t", getValues(a, b1));
printRow("b=a.clone()\t\t", getValues(a, b2));
printRow("b=Arrays.copyOf(a)\t", getValues(a, b3));
@ -24,9 +25,9 @@ public class CompareArrays1D {
private static void printRow(String col1, boolean[] values) {
System.out.println();
System.out.print(col1 + "\t");
System.out.print(col1);
for (boolean val : values) {
System.out.print(val + "\t");
System.out.print(val + "\t\t");
}
}

View File

@ -15,17 +15,18 @@ public class CompareArrays2D {
String[][] b3 = Arrays.copyOf(a, a.length);
String[][] b4 = { {"1","2","3"}, {"4", "5", "6"}, {"7", "8", "9"} };
System.out.print("b\t\t\tb==a\tb.equals(a)\tArrays.equals(a,b) deepEquals\t\tb[0]==a[0]");
printRow("b=a\t\t\t", getValues(a, b1));
printRow("b=a.clone()\t\t", getValues(a, b2));
printRow("b=Arrays.copyOf(a)\t", getValues(a, b3));
printRow("b4 = {\"1\",\"2\",\"3\"}, {\"4\",\"5...", getValues(a, b4));
printRow("b4 = {\"1\"...}, {\"4\"...\t", getValues(a, b4));
}
private static void printRow(String col1, boolean[] values) {
System.out.println();
System.out.print(col1 + "\t");
System.out.print(col1);
for (boolean val : values) {
System.out.print(val + "\t");
System.out.print(val + "\t\t");
}
}