Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
だから私は Java Util を作成していますが、コードのこの部分にこだわっています。
public void getInput(String i){ int i = scan.nextInt() }
なぜこれがうまくいかないのですか?
iはすでに宣言されてStringいますが、 として再宣言iしますint。それはうまくいきません!
i
String
int
名前は同じiだが型が異なる 2 つの変数があります。
のように変更します。
public void getInput(String i){ int data = scan.nextInt(); }
コンパイラエラーはなくなります。