Question: In the above code, two strings are evaluated using the equivalency operator. Why can this be a problem, and what other methods are offered by

 In the above code, two strings are evaluated using the equivalency

In the above code, two strings are evaluated using the equivalency operator. Why can this be a problem, and what other methods are offered by Java for working with characters and strings?

import java.util.Scanner; public class TryToCompareStrings public static void main(String[] args) String aName"Carmen"; String anotherName; Scanner input new Scanner(System.in) System.out.print("Enter your name>") anotherNmeinput.nextLineO: if(aNameanothen Name) System.out.println(aNameequals " + anotherName); else System.out.println (aName " does not equal "anotherName)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!