+ 7
♬Astro-GingyFlakeđŸ‡čđŸ‡· Use == cautiously as it isn't generally recommended for comparing string content, especially when dealing with string objects created using new String(). Prefer Equals() ( c# ) or equals() ( java) For accurate content comparison, always use the Equals() ( c# ) or equals() ( java) method. It ensures that the strings have the same characters in the same order, regardless of their memory location. By understanding this distinction, you can write more reliable and efficient Java code with equals() and c sharp with Equals() involving string comparisons.
27th Oct 2024, 3:41 AM
BroFar
BroFar - avatar
+ 5
♬Astro-GingyFlakeđŸ‡čđŸ‡· Change the if to if ((response.equals("hello"))||(response.equals("hi"))||(response.equals("hey"))) { System.out.println("DumbAi: Hello!");
27th Oct 2024, 3:18 AM
BroFar
BroFar - avatar