[HD-OCP17/21-Fundamentals Pg 299, Sec. 12.5.0 - enhancing-case-labels-with-guards]
Posted: Wed Sep 25, 2024 6:33 am
why no dominance here?
Code: Select all
Object obj = 10;
final int a = 50;
switch(obj){
case Integer d when a==a : {
System.out.println("Integer "+d);
break;
}
case Double d when a==a : {
System.out.println("Double "+d);
break;
}
default : System.out.println("Object "+obj);
}