Leave a Reply 3

Your email address will not be published. Required fields are marked *


renko

renko

Answer: D
package q067;

public class Test {

public static void main(String[] args) {
String[] strs = new String[2];
int idx = 0;
for (String s : strs) {
strs[idx].concat(” element “+ idx);
idx++;
}
for (idx = 0; idx < strs.length; idx++) {
System.out.println(strs[idx]);
}

}

}
/*Output:
Exception in thread "main" java.lang.NullPointerException
at q067.Test.main(Test.java:9)
*/