Reputation: 21
I am fairly new to programming and was following a tutorial on youtube and I got stuck at this code:
public static void main(String[] args) {
System.out.println(String.format("%02d", 1));
}
The code is supposed to print 01
as output but instead I get ??
, just 2 question marks. Can someone explain what I am doing wrong ?
Upvotes: 1
Views: 2619
Reputation: 21
Nevermind, I figured it out. Eclipse was using hindi format numbers to display output (don't know why ?). Setting project encoding to UTF-8 allowed me to see them instead of 'question marks'.
Upvotes: 1