Given:
2. class MyClass { 3. static String s = "-"; 4. String s2 = "s2"; 5. MyClass(String arg) { s += arg; } 6. } //from ww w.j a va 2s .c o m 7. public class Main extends MyClass { 8. Main() { super(s2); } 9. { s += "i "; } 10. public static void main(String[] args) { 11. new Main(); 12. System.out.println(s); 13. } 14. static { s += "sb "; } 15. }
What is the result?
E is correct.
The s2 variable is an instance variable that can't be used in the call to super because the instance hasn't been created yet.