Introduction
Sun Microsystems initially published Java in 1995 as a programming language and computing platform. It has grown from humble origins to power a significant portion of today's digital world by offering a secure foundation on which many services and applications are built. Java continues to be used in the development of new, innovative goods and digital services for the future.
Despite the fact that most recent Java applications integrate the Java runtime and the application, many programs, and even some websites will not work unless you have desktop Java installed.Hence learning about Java opens many different career paths and valuable opportunities. To become proficient in Java, one must understand different inbuilt methods in Java, one of which is equals(). We will be discussing the same below, along with its syntax and examples.
String equals() Method
The string equals() method in Java is used to compare whether two strings are equal or not.
Syntax:
string.equals(String str)
Parameters:
The equals method takes in a single parameter, str, which is of data type string.
Return Value:
- returns false if the strings are not equal
- returns true if the strings are equal
Let’s understand more about the method using some examples.