March 2019
Intermediate to advanced
242 pages
6h 21m
English
The following is an alternative that is meant to make the preceding code readable, by defining parts of the string value on multiple lines. However, when doing so, you should use multiple string concatenation operators (+) and string delimiters ("):
String html = "<HTML>" + "\n\t" + "<BODY>" + "\n\t\t" + "<H1>Meaning of life</H1>" + "\n\t" + "</BODY>" + "\n" + "</HTML>";
I would prefer to add whitespaces to the preceding code, to make it more readable:
String html = "<HTML>" +
"\n\t" + "<BODY>" +
"\n\t\t" + "<H1>Meaning of life</H1>" +
"\n\t" + "</BODY>" +
"\n" + "</HTML>";
Although the preceding code looks better in terms of readability, it delegates a lot of responsibility to the ...
Read now
Unlock full access