if string == string java code example
Example 1: java how to compare strings
System.out.println("hey".equals("hey")); //prints true
/*
always use .equals() instead of ==,
because == does the compare the string content but
loosely where the string is stored in.
*/
Example 2: how to know if String is the same java
String1.equals(String2)