Solved

What Does the Following Statement Sequence Print If the User

Question 78

Multiple Choice

What does the following statement sequence print if the user input is 123?
Public static void main(String[] args)
{
Scanner in = new Scanner(System.in) ;
System.out.print("Enter a number: ") ;
String str = in.next() ;
Str += 456;
System.out.println(str) ;
}


A) 579
B) Compile-time error
C) Run-time error
D) 123456

Correct Answer:

verifed

Verified

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

Related Questions