I am developing a console based application.
Is it a good idea to use System.out.println() to display error messages on the console? I am using a lot of these in my classes for error handling.
My class looks something like this:
public void validatePlayerSelection(String playerSelection, List<String> listOfIndex) {
    try {
        if (playerSelection == null || playerSelection.isEmpty()) {
            throw new NullPointerException();
        } else if (Integer.parseInt(playerSelection) < 11
                || Integer.parseInt(playerSelection) > ((size * 10) + size)) {
            System.out.println("The input you have entered cannot be found on the board");
        } else if (listOfIndex.contains(playerSelection)) {
            System.out.println("Cell already taken. Please select a different move.");
        } else {
            flag = false;
        }
    } catch (NumberFormatException e) {
        System.out.println("The input must be a number on the board");
    }
}
What is the alternative to System.out.println? Also, is this an efficient way to write code?
 
    