1

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 ?

singhakash
  • 7,891
  • 6
  • 31
  • 65
Ryū Jin
  • 21
  • 4

1 Answers1

1

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'.

Ryū Jin
  • 21
  • 4