Skip to content

Instantly share code, notes, and snippets.

@edinak1
Last active November 24, 2015 13:18
Show Gist options
  • Save edinak1/d34aa175ba9ee6035aa9 to your computer and use it in GitHub Desktop.
Save edinak1/d34aa175ba9ee6035aa9 to your computer and use it in GitHub Desktop.
package masivDuos;
import java.util.Arrays;
public class PrintArray {
public static void main(String[] args) {
String[][]data={{},
{"Oleg"},
{"Inna","Smith","25"},
{"Irina","Koval"},
{"Oleg","Kotov","16"},
null,
{},
{"Oleg","Anton",null,"Anna","25"}};
printArray(data);
}
static void printArray(String[][]data)
{
if(data==null)
return;
for(int i=0;i<data.length;i++)
{
if(data[i]==null || data[i].length==0)
continue;
for(int j=0; j<data[i].length;j++)
{
if(data[i][j]==null || data[i].length==0)
continue;
System.out.println(data[i][j]);
if(j==data[i].length-1)
System.out.println();
}
}
}
}
@liuiv15
Copy link

liuiv15 commented Nov 24, 2015

Правильнее элементы строки массива выводить в одну строку.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment