Code Room
Code reviewMediumcr-g332
Subject Data bugsLevel Mid–Senior~16 minCommon in Code quality & review interviewsIndustries Software development

Question

Review this Java code computing a per-seller average rating to display on a dashboard.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.

Talk through your review
Code to reviewjava
double avgRating(List<Integer> ratings) {    int sum = 0;    for (Integer r : ratings) {        sum += r;            // ratings may contain null for 'no score'    }    return (double) sum / ratings.size();}
Run or narrate your approach, then ask the coach.