oop - Confusing about the output -
i'm new java programming. start reading head first java book. , found example on first chapter.
public class beersong { public static void main(string[] args) { int beernum = 99; string word = "bottles"; while (beernum > 0) { if (beernum == 1) { word = "bottle"; } system.out.println(beernum + " " + word + " of beer on wall"); system.out.println(beernum + " " + word + " of beer"); system.out.println("take 1 down."); system.out.println("pass around."); beernum = beernum - 1; if (beernum > 0) { system.out.println(beernum + " " + word + " of beer on wall"); } else { system.out.println("no more bottles of beer on wall"); } } } }
and i'm confused out put.
60 bottles of beer take 1 down. pass around. 59 bottles of beer on wall 59 bottles of beer on wall 59 bottles of beer take 1 down. pass around. 58 bottles of beer on wall 58 bottles of beer on wall 58 bottles of beer take 1 down. pass around. 57 bottles of beer on wall 57 bottles of beer on wall 57 bottles of beer take 1 down. pass around. 56 bottles of beer on wall 56 bottles of beer on wall 56 bottles of beer take 1 down. pass around. 55 bottles of beer on wall 55 bottles of beer on wall 55 bottles of beer take 1 down. pass around. 54 bottles of beer on wall 54 bottles of beer on wall 54 bottles of beer take 1 down. pass around. 53 bottles of beer on wall 53 bottles of beer on wall 53 bottles of beer take 1 down. pass around. 52 bottles of beer on wall 52 bottles of beer on wall 52 bottles of beer take 1 down. pass around. 51 bottles of beer on wall 51 bottles of beer on wall 51 bottles of beer take 1 down. pass around. 50 bottles of beer on wall 50 bottles of beer on wall 50 bottles of beer take 1 down. pass around. 49 bottles of beer on wall 49 bottles of beer on wall 49 bottles of beer take 1 down. pass around. 48 bottles of beer on wall 48 bottles of beer on wall 48 bottles of beer take 1 down. pass around. 47 bottles of beer on wall 47 bottles of beer on wall 47 bottles of beer take 1 down. pass around. 46 bottles of beer on wall 46 bottles of beer on wall 46 bottles of beer take 1 down. pass around. 45 bottles of beer on wall 45 bottles of beer on wall 45 bottles of beer take 1 down. pass around. 44 bottles of beer on wall 44 bottles of beer on wall 44 bottles of beer take 1 down. pass around. 43 bottles of beer on wall 43 bottles of beer on wall 43 bottles of beer take 1 down. pass around. 42 bottles of beer on wall 42 bottles of beer on wall 42 bottles of beer take 1 down. pass around. 41 bottles of beer on wall 41 bottles of beer on wall 41 bottles of beer take 1 down. pass around. 40 bottles of beer on wall 40 bottles of beer on wall 40 bottles of beer take 1 down. pass around. 39 bottles of beer on wall 39 bottles of beer on wall 39 bottles of beer take 1 down. pass around. 38 bottles of beer on wall 38 bottles of beer on wall 38 bottles of beer take 1 down. pass around. 37 bottles of beer on wall 37 bottles of beer on wall 37 bottles of beer take 1 down. pass around. 36 bottles of beer on wall 36 bottles of beer on wall 36 bottles of beer take 1 down. pass around. 35 bottles of beer on wall 35 bottles of beer on wall 35 bottles of beer take 1 down. pass around. 34 bottles of beer on wall 34 bottles of beer on wall 34 bottles of beer take 1 down. pass around. 33 bottles of beer on wall 33 bottles of beer on wall 33 bottles of beer take 1 down. pass around. 32 bottles of beer on wall 32 bottles of beer on wall 32 bottles of beer take 1 down. pass around. 31 bottles of beer on wall 31 bottles of beer on wall 31 bottles of beer take 1 down. pass around. 30 bottles of beer on wall 30 bottles of beer on wall 30 bottles of beer take 1 down. pass around. 29 bottles of beer on wall 29 bottles of beer on wall 29 bottles of beer take 1 down. pass around. 28 bottles of beer on wall 28 bottles of beer on wall 28 bottles of beer take 1 down. pass around. 27 bottles of beer on wall 27 bottles of beer on wall 27 bottles of beer take 1 down. pass around. 26 bottles of beer on wall 26 bottles of beer on wall 26 bottles of beer take 1 down. pass around. 25 bottles of beer on wall 25 bottles of beer on wall 25 bottles of beer take 1 down. pass around. 24 bottles of beer on wall 24 bottles of beer on wall 24 bottles of beer take 1 down. pass around. 23 bottles of beer on wall 23 bottles of beer on wall 23 bottles of beer take 1 down. pass around. 22 bottles of beer on wall 22 bottles of beer on wall 22 bottles of beer take 1 down. pass around. 21 bottles of beer on wall 21 bottles of beer on wall 21 bottles of beer take 1 down. pass around. 20 bottles of beer on wall 20 bottles of beer on wall 20 bottles of beer take 1 down. pass around. 19 bottles of beer on wall 19 bottles of beer on wall 19 bottles of beer take 1 down. pass around. 18 bottles of beer on wall 18 bottles of beer on wall 18 bottles of beer take 1 down. pass around. 17 bottles of beer on wall 17 bottles of beer on wall 17 bottles of beer take 1 down. pass around. 16 bottles of beer on wall 16 bottles of beer on wall 16 bottles of beer take 1 down. pass around. 15 bottles of beer on wall 15 bottles of beer on wall 15 bottles of beer take 1 down. pass around. 14 bottles of beer on wall 14 bottles of beer on wall 14 bottles of beer take 1 down. pass around. 13 bottles of beer on wall 13 bottles of beer on wall 13 bottles of beer take 1 down. pass around. 12 bottles of beer on wall 12 bottles of beer on wall 12 bottles of beer take 1 down. pass around. 11 bottles of beer on wall 11 bottles of beer on wall 11 bottles of beer take 1 down. pass around. 10 bottles of beer on wall 10 bottles of beer on wall 10 bottles of beer take 1 down. pass around. 9 bottles of beer on wall 9 bottles of beer on wall 9 bottles of beer take 1 down. pass around. 8 bottles of beer on wall 8 bottles of beer on wall 8 bottles of beer take 1 down. pass around. 7 bottles of beer on wall 7 bottles of beer on wall 7 bottles of beer take 1 down. pass around. 6 bottles of beer on wall 6 bottles of beer on wall 6 bottles of beer take 1 down. pass around. 5 bottles of beer on wall 5 bottles of beer on wall 5 bottles of beer take 1 down. pass around. 4 bottles of beer on wall 4 bottles of beer on wall 4 bottles of beer take 1 down. pass around. 3 bottles of beer on wall 3 bottles of beer on wall 3 bottles of beer take 1 down. pass around. 2 bottles of beer on wall 2 bottles of beer on wall 2 bottles of beer take 1 down. pass around. 1 bottles of beer on wall 1 bottle of beer on wall 1 bottle of beer take 1 down. pass around. no more bottles of beer on wall press key continue . . .
as understand code out put should start
99 bottles of beer
because int beernum = 99;
can explain me why i'm getting above output start
60 bottles of beer
thanks in advance. great full if explain me this.
yes, output should begin with,
99 bottles of beer
there nothing wrong in code. said used geany ide. geany uses command line show output. if use eclipse or netbeans you'll proper output imagine.
eclipse output -
99 bottles of beer on wall 99 bottles of beer take 1 down. pass around. 98 bottles of beer on wall 98 bottles of beer on wall 98 bottles of beer take 1 down. pass around. 97 bottles of beer on wall 97 bottles of beer on wall 97 bottles of beer take 1 down. pass around. 96 bottles of beer on wall 96 bottles of beer on wall 96 bottles of beer take 1 down. pass around. 95 bottles of beer on wall 95 bottles of beer on wall 95 bottles of beer take 1 down. pass around. 94 bottles of beer on wall 94 bottles of beer on wall 94 bottles of beer take 1 down. pass around. 93 bottles of beer on wall 93 bottles of beer on wall 93 bottles of beer take 1 down. pass around. 92 bottles of beer on wall 92 bottles of beer on wall 92 bottles of beer take 1 down. pass around. 91 bottles of beer on wall 91 bottles of beer on wall 91 bottles of beer take 1 down. pass around. 90 bottles of beer on wall 90 bottles of beer on wall 90 bottles of beer take 1 down. pass around. 89 bottles of beer on wall 89 bottles of beer on wall 89 bottles of beer take 1 down. pass around. 88 bottles of beer on wall 88 bottles of beer on wall 88 bottles of beer take 1 down. pass around. 87 bottles of beer on wall 87 bottles of beer on wall 87 bottles of beer take 1 down. pass around. 86 bottles of beer on wall 86 bottles of beer on wall 86 bottles of beer take 1 down. pass around. 85 bottles of beer on wall 85 bottles of beer on wall 85 bottles of beer take 1 down. pass around. 84 bottles of beer on wall 84 bottles of beer on wall 84 bottles of beer take 1 down. pass around. 83 bottles of beer on wall 83 bottles of beer on wall 83 bottles of beer take 1 down. pass around. 82 bottles of beer on wall 82 bottles of beer on wall 82 bottles of beer take 1 down. pass around. 81 bottles of beer on wall 81 bottles of beer on wall 81 bottles of beer take 1 down. pass around. 80 bottles of beer on wall 80 bottles of beer on wall 80 bottles of beer take 1 down. pass around. 79 bottles of beer on wall 79 bottles of beer on wall 79 bottles of beer take 1 down. pass around. 78 bottles of beer on wall 78 bottles of beer on wall 78 bottles of beer take 1 down. pass around. 77 bottles of beer on wall 77 bottles of beer on wall 77 bottles of beer take 1 down. pass around. 76 bottles of beer on wall 76 bottles of beer on wall 76 bottles of beer take 1 down. pass around. 75 bottles of beer on wall 75 bottles of beer on wall 75 bottles of beer take 1 down. pass around. 74 bottles of beer on wall 74 bottles of beer on wall 74 bottles of beer take 1 down. pass around. 73 bottles of beer on wall 73 bottles of beer on wall 73 bottles of beer take 1 down. pass around. 72 bottles of beer on wall 72 bottles of beer on wall 72 bottles of beer take 1 down. pass around. 71 bottles of beer on wall 71 bottles of beer on wall 71 bottles of beer take 1 down. pass around. 70 bottles of beer on wall 70 bottles of beer on wall 70 bottles of beer take 1 down. pass around. 69 bottles of beer on wall 69 bottles of beer on wall 69 bottles of beer take 1 down. pass around. 68 bottles of beer on wall 68 bottles of beer on wall 68 bottles of beer take 1 down. pass around. 67 bottles of beer on wall 67 bottles of beer on wall 67 bottles of beer take 1 down. pass around. 66 bottles of beer on wall 66 bottles of beer on wall 66 bottles of beer take 1 down. pass around. 65 bottles of beer on wall 65 bottles of beer on wall 65 bottles of beer take 1 down. pass around. 64 bottles of beer on wall 64 bottles of beer on wall 64 bottles of beer take 1 down. pass around. 63 bottles of beer on wall 63 bottles of beer on wall 63 bottles of beer take 1 down. pass around. 62 bottles of beer on wall 62 bottles of beer on wall 62 bottles of beer take 1 down. pass around. 61 bottles of beer on wall 61 bottles of beer on wall 61 bottles of beer take 1 down. pass around. 60 bottles of beer on wall 60 bottles of beer on wall 60 bottles of beer take 1 down. pass around. 59 bottles of beer on wall 59 bottles of beer on wall 59 bottles of beer take 1 down. pass around. 58 bottles of beer on wall 58 bottles of beer on wall 58 bottles of beer take 1 down. pass around. 57 bottles of beer on wall 57 bottles of beer on wall 57 bottles of beer take 1 down. pass around. 56 bottles of beer on wall 56 bottles of beer on wall 56 bottles of beer take 1 down. pass around. 55 bottles of beer on wall 55 bottles of beer on wall 55 bottles of beer take 1 down. pass around. 54 bottles of beer on wall 54 bottles of beer on wall 54 bottles of beer take 1 down. pass around. 53 bottles of beer on wall 53 bottles of beer on wall 53 bottles of beer take 1 down. pass around. 52 bottles of beer on wall 52 bottles of beer on wall 52 bottles of beer take 1 down. pass around. 51 bottles of beer on wall 51 bottles of beer on wall 51 bottles of beer take 1 down. pass around. 50 bottles of beer on wall 50 bottles of beer on wall 50 bottles of beer take 1 down. pass around. 49 bottles of beer on wall 49 bottles of beer on wall 49 bottles of beer take 1 down. pass around. 48 bottles of beer on wall 48 bottles of beer on wall 48 bottles of beer take 1 down. pass around. 47 bottles of beer on wall 47 bottles of beer on wall 47 bottles of beer take 1 down. pass around. 46 bottles of beer on wall 46 bottles of beer on wall 46 bottles of beer take 1 down. pass around. 45 bottles of beer on wall 45 bottles of beer on wall 45 bottles of beer take 1 down. pass around. 44 bottles of beer on wall 44 bottles of beer on wall 44 bottles of beer take 1 down. pass around. 43 bottles of beer on wall 43 bottles of beer on wall 43 bottles of beer take 1 down. pass around. 42 bottles of beer on wall 42 bottles of beer on wall 42 bottles of beer take 1 down. pass around. 41 bottles of beer on wall 41 bottles of beer on wall 41 bottles of beer take 1 down. pass around. 40 bottles of beer on wall 40 bottles of beer on wall 40 bottles of beer take 1 down. pass around. 39 bottles of beer on wall 39 bottles of beer on wall 39 bottles of beer take 1 down. pass around. 38 bottles of beer on wall 38 bottles of beer on wall 38 bottles of beer take 1 down. pass around. 37 bottles of beer on wall 37 bottles of beer on wall 37 bottles of beer take 1 down. pass around. 36 bottles of beer on wall 36 bottles of beer on wall 36 bottles of beer take 1 down. pass around. 35 bottles of beer on wall 35 bottles of beer on wall 35 bottles of beer take 1 down. pass around. 34 bottles of beer on wall 34 bottles of beer on wall 34 bottles of beer take 1 down. pass around. 33 bottles of beer on wall 33 bottles of beer on wall 33 bottles of beer take 1 down. pass around. 32 bottles of beer on wall 32 bottles of beer on wall 32 bottles of beer take 1 down. pass around. 31 bottles of beer on wall 31 bottles of beer on wall 31 bottles of beer take 1 down. pass around. 30 bottles of beer on wall 30 bottles of beer on wall 30 bottles of beer take 1 down. pass around. 29 bottles of beer on wall 29 bottles of beer on wall 29 bottles of beer take 1 down. pass around. 28 bottles of beer on wall 28 bottles of beer on wall 28 bottles of beer take 1 down. pass around. 27 bottles of beer on wall 27 bottles of beer on wall 27 bottles of beer take 1 down. pass around. 26 bottles of beer on wall 26 bottles of beer on wall 26 bottles of beer take 1 down. pass around. 25 bottles of beer on wall 25 bottles of beer on wall 25 bottles of beer take 1 down. pass around. 24 bottles of beer on wall 24 bottles of beer on wall 24 bottles of beer take 1 down. pass around. 23 bottles of beer on wall 23 bottles of beer on wall 23 bottles of beer take 1 down. pass around. 22 bottles of beer on wall 22 bottles of beer on wall 22 bottles of beer take 1 down. pass around. 21 bottles of beer on wall 21 bottles of beer on wall 21 bottles of beer take 1 down. pass around. 20 bottles of beer on wall 20 bottles of beer on wall 20 bottles of beer take 1 down. pass around. 19 bottles of beer on wall 19 bottles of beer on wall 19 bottles of beer take 1 down. pass around. 18 bottles of beer on wall 18 bottles of beer on wall 18 bottles of beer take 1 down. pass around. 17 bottles of beer on wall 17 bottles of beer on wall 17 bottles of beer take 1 down. pass around. 16 bottles of beer on wall 16 bottles of beer on wall 16 bottles of beer take 1 down. pass around. 15 bottles of beer on wall 15 bottles of beer on wall 15 bottles of beer take 1 down. pass around. 14 bottles of beer on wall 14 bottles of beer on wall 14 bottles of beer take 1 down. pass around. 13 bottles of beer on wall 13 bottles of beer on wall 13 bottles of beer take 1 down. pass around. 12 bottles of beer on wall 12 bottles of beer on wall 12 bottles of beer take 1 down. pass around. 11 bottles of beer on wall 11 bottles of beer on wall 11 bottles of beer take 1 down. pass around. 10 bottles of beer on wall 10 bottles of beer on wall 10 bottles of beer take 1 down. pass around. 9 bottles of beer on wall 9 bottles of beer on wall 9 bottles of beer take 1 down. pass around. 8 bottles of beer on wall 8 bottles of beer on wall 8 bottles of beer take 1 down. pass around. 7 bottles of beer on wall 7 bottles of beer on wall 7 bottles of beer take 1 down. pass around. 6 bottles of beer on wall 6 bottles of beer on wall 6 bottles of beer take 1 down. pass around. 5 bottles of beer on wall 5 bottles of beer on wall 5 bottles of beer take 1 down. pass around. 4 bottles of beer on wall 4 bottles of beer on wall 4 bottles of beer take 1 down. pass around. 3 bottles of beer on wall 3 bottles of beer on wall 3 bottles of beer take 1 down. pass around. 2 bottles of beer on wall 2 bottles of beer on wall 2 bottles of beer take 1 down. pass around. 1 bottles of beer on wall 1 bottle of beer on wall 1 bottle of beer take 1 down. pass around. no more bottles of beer on wall
Comments
Post a Comment