Multiple choice technology programming languages

  1. class Base{} 2. public class MyCast extends Base{ 3. static boolean b1=false; 4. static int i = -1; 5. static double d = 10.1; 6. public static void main(String argv[]){ 7. MyCast m = new MyCast(); 8. Base b = new Base(); 9. //………..Here 10. }}

  1. b=m;

  2. m=b;

  3. d =i;

  4. b1 =i;

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

In Java, a subclass reference (MyCast) can be assigned to a superclass reference (Base) without explicit casting - this is called upcasting and is always safe because a MyCast object 'is-a' Base through inheritance. The reverse (m=b) would require downcasting and could fail at runtime. Options C and D are invalid due to type incompatibility between double and boolean.