Question: The program below incorrectly echoes the user's input to the output. Try submitting it for grading ( click Submit mode, then Submit for grading )

The program below incorrectly echoes the user's input to the output.
Try submitting it for grading (click "Submit mode", then "Submit for grading"). Notice that the test cases fail. The first test case's highlighting indicates that output 3 and newline were not expected. In the second test case, the -5 and newline were not expected.
Remove the code that echoes the user's input back to the output, and submit again. Now the test cases should all pass. import java.util.Scanner;
public class DoubleNum{
public static void main(String[] args){
Scanner scnr=new Scanner(System.in);
int x;
System.out.println("Enter x: ");
x=scnr.nextInt();
System.out.println(x);
System.out.println("x doubled is: "+(2*x));

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!