Code Room
Code reviewMedium
Question
Review this Java code that reads the first line of a file.
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.
Learn the concepts
String firstLine(String path) throws IOException { BufferedReader r = new BufferedReader(new FileReader(path)); String line = r.readLine(); r.close(); return line;}Run or narrate your approach, then ask the coach.