【发布时间】:2013-11-05 03:56:36
【问题描述】:
如何在 print 语句中编写 if 语句?
public boolean checkEmpty()
{
if(array.isEmpty)
{
Sytem.out.println("The List is empty");
}
else
{
System.out.println("The list has: " + if(array.size() > 1)) {"Items"} + else {"item"} );
}
}
【问题讨论】:
-
与确切的问题无关,但我认为您的意思是实际打印出项目的数量,而不仅仅是“项目”或“项目”。
标签: java if-statement printing boolean system.out