Skip to content

Instantly share code, notes, and snippets.

@Yur-ok
Created January 14, 2016 16:06
Show Gist options
  • Save Yur-ok/43a6b38a29132cda77ca to your computer and use it in GitHub Desktop.
Save Yur-ok/43a6b38a29132cda77ca to your computer and use it in GitHub Desktop.
package Lesson3.KeyPoint5;
import java.util.Arrays;
/**
* Created by Юрий on 14.01.2016.
*/
public class PrintArrayVoid {
public static void main(String[] args) {
String[][] nul = new String[2][];
String[][] a = {{"Oleg"}, {"Inna", "Smith", "25"}, {"Irina", "Koval"}};
String[][] b = {null, {"Oleg", "Kotov", "16"}};
String[][] c = {{"Oleg"}, {"Anton"}, null, {"Anna", "25"}};
// System.out.println(nul.length);
printArray(nul);
printArray(a);
printArray(b);
printArray(c);
}
static void printArray(String[][] data) {
if (data != null) {
for (int i = 0; i <= data.length - 1; i++) {
if (data[i] != null) {
for (int j = 0; data[i] != null && j <= data[i].length - 1; j++) {
System.out.print(data[i][j] + " ");
}
System.out.println();
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment