更新时间:2023-11-13 15:47:34
三元运营商不能拥有不返回值的语句, void
方法。您需要具有返回值的语句。
Ternary operators can't have statements that don't return values, void
methods. You need statements that have return values.
您需要重写它。
void bark(boolean hamlet) {
System.out.println( hamlet ? "To Bark." : "Not to Bark" );
}