string.equals()
String.equals() Checks two strings and returns boolean vlaue true if both are equal.
Syntax
String1.equals(String2)
Return value is boolean ( true or false )
Here are some examples with output.
String my_str1="plus2net";
System.out.println(my_str1.equals("plus2net")); // true
System.out.println(my_str1.equals("Plus2net")); // false
System.out.println(my_str1.equals("2net")); // false
This is case sensitive matching of two strings
« All String functions
« Java
This article is written by plus2net.com team.
plus2net.com