Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The following Java program has 11 errors. Can you find them all? 1 2 3 4 5 6 7 8

ID: 3662862 • Letter: T

Question

The following Java program has 11 errors. Can you find them all?

   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  
  public class StringOops {      public static void main(String[] args) {          Scanner console = new Scanner(System.in);          System.out.print("Type your name: ");          String name = console.nextString();          process(name);      }        public static void process(string "name") {          if (name == Whitaker) {              System.out.println("You must be really awesome.");          }          replace("a", "e");          toUppercase(name);          name.substring(0, 3);          System.out.println(name + " has " + name.length + " letters");      }  }  

Explanation / Answer

There are 8 errors

1. Scanner cannot be resolved to a type
2. The method nextString() is undefined for Scanner
3. The method process() in the type StringOops is not applicable for the arguments (String
4. Syntax error on token ""name"", invalid VariableDeclaratorId
5. insert } to complete class body
6. Syntax error on token ""name"", invalid VariableDeclaratorId
7. The method process() in the type StringOops is not applicable for the arguments (String)
8. Syntax error on token "}", delete this token