Answers for "java check if array is empty"

1

java check if args is empty

if (args.length == 0)
  //check
}//if (no argument passed as input)
Posted by: Guest on December-10-2019
0

java check if array element is null

public class test {

    public static void main(String[] args) {
        Object[][] someArray = new Object[5][];
        someArray[0] = new Object[10];
        someArray[1] = null;
        someArray[2] = new Object[1];
        someArray[3] = null;
        someArray[4] = new Object[5];

        for (int i=0; i<=someArray.length-1; i++) {
            if (someArray[i] != null) {
                System.out.println("not null");
            } else {
                System.out.println("null");
            }
        }
    }
}

$ /cygdrive/c/Program\ Files/Java/jdk1.6.0_03/bin/java -cp . test
not null
null
not null
null
not null
Posted by: Guest on February-08-2021
0

isempty for arrays

int arr[] = null;
if (arr == null) {
  System.out.println("array is null");
}
Posted by: Guest on November-22-2020

Code answers related to "java check if array is empty"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language