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
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); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
