As per my knowledge what you are doing is partially correct.
Because, initially, the ResultSet's cursor will be pointing to before the first row. Now, if the first call to next() returns false then there is no data in the ResultSet. So, you will also have to call beforeFirst() immediately in order to reset it.
if (!resultSet.isBeforeFirst() ) {
System.out.println("No data");
}