Whistle in the Dark

What does the idiom “Whistle in the Dark” mean?

Definition:

To be unrealistically confident or brave; to talk about something of which one has little knowledge

For example:

“John thinks he can win the match, but he’s just whistling in the dark.”