Answer:
The corrected code is as follows:
import java.util.Scanner;
public class U2_L4_Activity_Two{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
String str1 = scan.nextLine();
String str2 = str1;
str1 = str1.toUpperCase();
System.out.println(str1);
System.out.println(str2);
}
}
Explanation:
This corrects the scanner object
Scanner scan = new Scanner(System.in);
This line is correct
String str1 = scan.nextLine();
This copies str1 to str2
String str2 = str1;
This converts str1 to upper case
str1 = str1.toUpperCase();
This prints str1
System.out.println(str1);
This prints str2
System.out.println(str2);