java - Duplicate local variable n -


I am trying to solve the problem in Java, and am trying to find the answer. I could not find anything other than this fact, which I have declared a variable twice, which I do not know

I received the user input for the starting number of the bottle, an integer "N" I am trying to do Please help and tell me how to change it and fix it.

Here is a section of my code:

  public class bottlefoods {Private stationary scanner bottle; Bottles.useDelimiter ("\ n"); Bottles in the beer bottle Bottle on "System.out.println (" "" Beetle "+" Bottles in the Song " Enter the initial number of: "); int n = bottles.nextInt (); if (n> gt; 1) {System.out.print (n +" beer bottles on the wall, "+ +" bottles of bottles , Then "take one down," + or "pass around it"); N = n - 1; System.out.println (n + "beer bottles on the wall."); Number (n); } Else {if (n == 1) {System.out.print (n + "beer bottle on the wall," + n + "bye "Bottom of the bottle, then" take one down, "+" or pass it, "); N = n - 1; System.out.println (n +" beer bottles on the wall. "); Number (n); } Else {System.out.println ("There is no other bottle of beer on the wall", "There is no beer bottle, then one can not take down," + "or can not pass it," the reason There is no bottle of beer on the wall! ");}}}  

< P> You have the argument n your number method and the signature of the variable n Rate is defined because there is no way to tell the compiler two different, so you have to change the name of one of them.

  public static zero number (int n) {// pre-n bottles = new scanner (System.in); Bottles.useDelimiter ("\ n"); Enter the starting number of the bottle "+" in "beer" on the system.out.println ("" "Beer Bottle song" + "": "); Int n = bottles.nextInt (); // seconds N  

Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -