+ 2
When do we use %s and why?
may someone please explain the basics for the use of this command "%s". I highly appreciate it.
3 Answers
+ 4
when you use the method String.format() the '%s' is replaced by the following arguments, here an example:
String.format("I like %s! It's really %s, "SoloLearn", "Cool");
Output: I like SoloLearn, it's really Cool
+ 2
% would be the place holder for the value and the s declares that the value will be a string, I dont know that much in Java so am using C++ logic here. (Ik Java is really similar to C++)
0
thanks guys