Ternary operators can't have statements that don't return values, void
methods. You need statements that have return values.
You need to rewrite it.
void bark(boolean hamlet) {
System.out.println( hamlet ? "To Bark." : "Not to Bark" );
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…