Hey Everybody.
Jimmy is right. we have to place the first If loop after statements ans the output got correct.
One thing more I noticed that when control enter while loop it first go to the If loop and print the statement under this loop first:
if (beerNum > 0) {
System.out.println(beerNum + " " + word + " of beer on the wall");
}
and the goes to the while loop statements. Am i correct?