I have a small piece of code that i don't understand the output.
This output is adding spaces to my string format text. I'm doing something wrong?
public class HelloWorld{
public static void main(String []args){
int a1 = 540;
int a2 = 492;
int a3 = 200;
int a4 = 500;
int a5 = 600;
String a = "/share.html?title=%1s&description=%2s&image=%3s&width=%4s&height=%5s";
String b = String.format(a, a1, a2, a3, a4, a5);
System.out.println(b);
}
}
The output is:
/share.html?title=540&description=492&image=200&width= 500&height= 600
Why there are those spaces on the last width and height?
%1$s,%2$s,%3$s,%4$setc. Or simply%s.