You can't write an if
statement inside an expression like that.
However, you can use Java's ternary operator ?:
(scroll down about half way in the linked page) to embed a conditional expression:
System.out.println("The list has: " + ((array.size() > 1) ? "items" : "item"));
The format is:
booleanCondition ? valueIfTrue : valueIfFalse