Chener Zhang :
how to print multiple int in java using System.out.println?
int a = 1;
int b = 2;
int c = 3;
System.out.println("%d%d%d",a,b,c); // error occurs
Mureinik :
I think you meant to use printf()
, not println()
:
System.out.printf("%d%d%d%n", a, b, c);
(%n
prints a platform-specific line-separator, to stay consistent with the original output.)
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=335528&siteId=1