Answer:
import java.util.Scanner;
public class NumSquared {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
int userNum = 0;
int userNumSquared;
userNum = scnr.nextInt();
userNumSquared = userNum * userNum; // Bug here; fix it when instructed
System.out.println(userNumSquared); // Output formatting issue here; fix it when instructed
}
}
Explanation:
For case 1 you can in initialize the input with a number as have done.
For case 2, I changed the '+' to '*' so that I can get the square as required by the question
For case 3, I used a println(), because it will print the value of UserNumSquared and also print a new line.