public class Avatar • public Avatar () public class Fire extends Avatar public class Earth extends Avatar public Fire() • public Earth () Avatar al = new Earth(); = new Fire(); Avatar a2 Earth e = new...



Please answer question. This is pertaining to Java programming language


3-3




public class Avatar<br>• public Avatar ()<br>public class Fire extends Avatar<br>public class Earth extends Avatar<br>public Fire()<br>• public Earth ()<br>Avatar al = new Earth();<br>= new Fire();<br>Avatar a2<br>Earth e = new Earth();<br>Fire f = new Fire();<br>For the class hierarchy and declarations above, correctly indicate whether each of the<br>following statements will compile and what will happen at runtime (runs correctly or<br>runtime exception). It may be helpful to use scratch paper to keep track of each<br>variable's static and dynamic type.<br>1 Avatar avatar<br>(Avatar) f;<br>Fire f1 = (Fire) al;<br>(Fire) a2;<br>(Fire) e;<br>2<br>Fire f2<br>4<br>Fire f3 =<br>1:<br>[ Select ]<br>[ Select ]<br>does not compile<br>compiles, but runtime exception<br>compiles and runs<br>2:<br>3 : TSeiect j<br>4: [Select ]<br>><br>><br>

Extracted text: public class Avatar • public Avatar () public class Fire extends Avatar public class Earth extends Avatar public Fire() • public Earth () Avatar al = new Earth(); = new Fire(); Avatar a2 Earth e = new Earth(); Fire f = new Fire(); For the class hierarchy and declarations above, correctly indicate whether each of the following statements will compile and what will happen at runtime (runs correctly or runtime exception). It may be helpful to use scratch paper to keep track of each variable's static and dynamic type. 1 Avatar avatar (Avatar) f; Fire f1 = (Fire) al; (Fire) a2; (Fire) e; 2 Fire f2 4 Fire f3 = 1: [ Select ] [ Select ] does not compile compiles, but runtime exception compiles and runs 2: 3 : TSeiect j 4: [Select ] > >

Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here