how can i write "%" in java printf method -
this question has answer here:
i want know how can write "%", in java printf() method.
for example : system.out.printf("it has %.4f%", a); hoped output : had 33.3333%
but, had unknownformatconversionexception error.
so, how can change that?
the % sign should escaped %. example:
system.out.printf("it has %%%.4f%%", a); will print: it has %33.3333%, a = 33.33333f;
Comments
Post a Comment