how can I check if this two dimentinal array is empty?
this is my code :
String[][] user = new String[5][3];
System.out.print(user.length);
if (user.length == 5 ){
System.out.print("\n empty");
}
for (int j=0; j<3; j++) {
System.out.print(" " + user[0][j]+ "\n");
}
and the output is :
5
empty null null null
Does anyone have an ide about my situation?
You are misunderstanding something in Java I think. When you write :
If you want to check if all value in your array are emty you can do something like :
Another solution would be to use
Arrays.deepEquals: