Printing ?? instead of number in String.format("%02d",10) in java

81 views Asked by At

I am writing code for formating using String.format. so in genral it should print number only but instead of printing number it is printing ??. here is code.

Any suggestion please what i'm doing wrong here. Thanks in advance.

code

int num=10;
String str='a'+String.format("%02d", num);
System.out.println(str);

output:

a??
0

There are 0 answers