Can a string literal extend over several lines? why or why not?
Can a string literal extend over several lines?
Collapse
X
-
-
String literal can not have new line character(\u000a). So that mean's it can not be more than a line.
Regards
Dheeraj Joshi -
However, you can do something like
if you want to separate your string. This will print asCode:String test = "Line 1 " + "Line 2";
If you want to add a line break to the output as well, it would beCode:Line 1 Line 2
which would print asCode:String test = "Line 1\n" + "Line 2";
Greetings,Code:Line 1 Line 2
NepomukComment
Comment