Describe the scope error in the following program and explain how to fix it. public class Conversation
Question:
Describe the scope error in the following program and explain how to fix it.
public class Conversation
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.print("What is your first name? ");
String input = in.next();
System.out.println("Hello, " + input);
System.out.print("How old are you? ");
int input = in.nextInt();
input++;
System.out.println("Next year, you will be " + input);
}
}
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Question Posted: