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

Java expert please help If two strings are equal, the two strings have the same

ID: 3834202 • Letter: J

Question

Java expert please help

If two strings are equal, the two strings have the same hashCodes. true false Which statement is true of the following snippet? Scanner kybd = new Scanner(System.in); String inp = kybd. next (); int i = 0; int n = 0; if (inp == "sophie") i = 3; if ("sophie".equalsIgnoreCase(inp)) n = 5; System. out. print-In ("result is " + (i + n) ) ; kybd. close () ; the code never prints 0 if the user enters sophie the code prints 8 if the user enters sophie or SOPHIE the code prints 5 there is a compile problem at line 11

Explanation / Answer

13) If two strings are equal than its not mandatory their hashcodes are always equal .it can be equal but not everytime.

So this statement is false.

14) Answer is b

If user enters shopie the code prints 8

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote