


CodePudding user response:
Hit a double quotation marks, and the inside of the parentheses in the println method first character,CodePudding user response:
The elder brothers, so string concatenation is too much trouble, also not good maintenance, you can try this:The String. Format (" Hello, % s ", "World!" );
Input the result is a Hello World! The first parameter. The format function similar to a string of template, you can complete your information write this here, part of the dynamic, can use a % s (string), % d (digital) such a wildcard instead, starting from the second parameter, is used to replace the wildcard before variables, according to the order in the can, give you an example:
String name="zhang SAN";
Int the age=27;
The String. Format (" [% s] personal information: name, age (% d) ", the name, age);