May 2022
Intermediate to advanced
688 pages
20h 12m
English
The last preliminary step is to create a template crime report that can be configured with the specific crime’s details. Because you will not know a crime’s details until runtime, you must use a format string with placeholders that can be replaced at runtime. Here is the format string you will use:
%1$s! The crime was discovered on %2$s. %3$s, and %4$s
%1$s, %2$s, etc. are placeholders that expect string arguments.
In code, you will call getString(…) and pass in the format string and four other strings in the order in which they should replace the placeholders. The result will be a report along the lines of, “Stolen yogurt! The crime was discovered on Wed., May 11. The case is not solved, and there is no ...
Read now
Unlock full access