Q: Will the following program compile? Run without exceptions? If so, what will it print?
public class Foo {
public static void main(String[] args) {
String[][] sss = new String[2][];
int c = 0;
for (String[] ss: sss) {
ss = new String[3];
for (String s: ss) {
s = "Slot # " + c++;
}
}
for (String[] ss: sss) {
for (String s: ss) {
System.out.println(s);
}
}
}
}
Strict rules this week: you must not actually compile the program before answering the questions.