gpt4 book ai didi

Java Switch 命中两个案例

转载 作者:行者123 更新时间:2023-11-29 10:00:41 25 4
gpt4 key购买 nike

<分区>

我正在尝试处理带有要处理的切换案例的组合用户输入,在最终切换之前它似乎进展顺利

    System.out.println("\t output switch =  " + state.get(2));
switch(state.get(2)){
//Case MCNP
case 0:
{
abundances = verifyAndNorm(abundances, new MCNPVerifier(MCNP));
out = toMCNP(mat, abundances);
System.out.println("\t MCNP");
}

//Case SCALE
case 1:
{
abundances = verifyAndNorm(abundances, new SCALEVerifier(SCALE));
out = toSCALE(mat, abundances, weightFracFlag);
System.out.println("\t SCALE");
}
}

打印出来

 output switch =  0
MCNP
SCALE

结果是 out = toScale(...),并且由于它同时打印 MCNP 和 SCALE,所以它必须同时满足这两种情况,但它只适用于一种情况...

我在这里错过了什么?

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com