1. Which of the following statements contains an error?

I. Scanner in = new Scanner(System.in.print);
II. System.out.print("Please enter your name (first last): ");
III. String firstName = in.next();
I only
II only
III only
I and II only
II and III only
2. Which of the following statements contains an error?
I. String firstName = in.next();
II. String lastName = in.nextline();
III. System.out.print("\n");
I only
II only
III only
I and II only
II and III only

Respuesta :

In the first one,statement 1 and 2 have errors in them.
I. Scanner in = new Scanner(System.in.print);
II. System.out.print("Please enter your name (first last): ");

In  the second one, statement 2 has an error.
II. String lastName = in.nextline();

Answer:

Your answer is I. Scanner in = new Scanner(System.in.print);

II. System.out.print("Please enter your name (first last): ");

Explanation: