Code Room
Code reviewMediumcr-g116
Subject LocaleLevel Mid–Senior~25 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

Review this Java code that parses a price string from a form post.

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
import java.text.NumberFormat; double parsePrice(String s) throws Exception {    NumberFormat nf = NumberFormat.getInstance();   // default locale    return nf.parse(s).doubleValue();} // parsePrice("1.234")  on a de-DE server
Run or narrate your approach, then ask the coach.