Solved

Assuming That the User Inputs "Joe" at the Prompt, What

Question 11

Multiple Choice

Assuming that the user inputs "Joe" at the prompt, what is the output of the following code snippet?
Public static void main(String[] args)
{
System.out.print("Enter your name ") ;
String name;
Scanner in = new Scanner(System.in) ;
Name = in.next() ;
Name += ", Good morning";
System.out.print(name) ;
}


A) The code snippet does not compile because the += operator cannot be used in this context.
B) Joe, Good morning
C) , Good morning
D) Joe

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions