Given:
1. class Printable { 2. String doStuff() { return "howdy "; } 3. } /*from w w w. j av a 2 s.co m*/ 4. class Main extends Printable { 5. String doStuff() { return "send money "; } 6. public static void main(String[] args) { 7. Main s1 = new Main(); 8. Printable c3 = new Printable(); 9. Printable c1 = s1; 10. Main s2 = (Main) c1; 11. Main s3 = (Main) c3; 12. Main s4 = new Printable(); 13. } }
Which are true? (Choose all that apply.)
D is correct.
Once line 12 is removed, the code will compile but throw a ClassCastException at line 11.