पहली अनुक्रमणिका शून्य (खाली) पर सेट है, लेकिन यह सही आउटपुट मुद्रित नहीं करती है, क्यों?क्यों सूचीबद्ध नहीं है .get (0) .equals (शून्य) काम करते हैं?
//set the first index as null and the rest as "High"
String a []= {null,"High","High","High","High","High"};
//add array to arraylist
ArrayList<Object> choice = new ArrayList<Object>(Arrays.asList(a));
for(int i=0; i<choice.size(); i++){
if(i==0){
if(choice.get(0).equals(null))
System.out.println("I am empty"); //it doesn't print this output
}
}
एक चाल: 'System.out.println (Arrays.asList (शून्य," उच्च "," उच्च "," उच्च "," उच्च "," उच्च ")); 'जो कुछ भी आप चाहते हैं उसके बिना करता है अतिरिक्त कोड मैं इसे "वही" कहता हूं क्योंकि आपको शायद पता नहीं था कि आप nulls – Pyrolistical