The Java equals() method is used to compare objects. The equals() returns true if this object is equal to the given object. Otherwise, it returns false.Demos and Full Guide
toString() method returns the string or textual representation of an object.
The string specifies the object’s class which is followed by ‘@’ sign and the hashcode of the object (unsigned hexadecimal representation).
The Java printf method is used to write the formatted strings. The ‘f’ in printf keyword means formatted. The printf method belongs to the PrintStream and PrintWriter classes.Demos and Full Guide
You may use a number of ways for reversing the strings in Java programs. If you are working with mutable strings by using StringBuilder or StringBuffer class then these classes have built-in reverse method.Demos and Full Guide
StringBuffer and StringBuilder classes allow creating mutable sequence of characters. At any point of the program, you may change the content of StringBuffer/StringBuilder objects by using methods.Demos and Full Guide
These methods can be used for number to string conversion: 1- toString() 2- String.valueOf, 3- String concatenation operator (+) 4- String.format() 5- StringBuffer 6- StringBuilderDemos and Full Guide
The charAt(int) method returns the character in the specified string for given index number. The index of string starts at zero.Demos and Full Guide
The Java indexOf returns the index of given character or substring for the first occurrence in the specified string. To get the last occurrence of the given substring or character, use the lastIndexOf() method.Demos and Full Guide
Java has a built-in method for sorting the elements in collections like ArrayLists, LinkedList etc. The arrays class also has a built-in method “sort” that enables sorting the arrays only.Demos and Full Guide
The continue statement is used to skip current iteration in the for and while loops in Java. In the case of Java for loop, the execution moves to the update counter as it meets the continue statement.Demos and Full Guide
The split method breaks the specified string by the given regular expression delimiter and returns an array. The array contains substrings of the specified string after splitting.Demos and Full Guide
For string comparison in Java, you may use the equals() and compareTo() methods. Both of these methods are explained below with examples.Demos and Full Guide
Java comes up with built-in functions to let us convert strings to int. These methods are parseInt and valueOf. This is the topic of this tutorial.Demos and Full Guide
The trim() method of Java can be used for removing the whitespaces from left and right of the given string. The leading or trailing spaces may occur particularly, as you are taking user input.Demos and Full Guide
The String replace method of Java is used to replace the existing character(s) in the given string to the new given character(s). The replace method returns a new string which is the replaced string.Demos and Full Guide