🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Docs and Production: all 10 questions

Quiz: Docs and Production · Question 2 of 10

Which logging line follows best practice?

Which logging line follows best practice?

  1. A.System.out.println("Enrolled " + email);
  2. B.log.info("Enrolled " + email + " in " + courseId);
  3. C.log.info("Student {} enrolled in course {}", email, courseId);
  4. D.log.error("Enrolled ok");
Answer & explanation

Correct answer: log.info("Student {} enrolled in course {}", email, courseId);

Placeholders avoid building strings when the level is off, and INFO suits a business event.

Can you get the rest right without peeking?

Take the timed Quiz: Docs and Production quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →