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. Belongs Continue Reading
Java Tutorials
In general, the Java toString() method is used to return the string or textual representation of an object. The object class’s toString method returns a string as Continue Reading
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 Continue Reading
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 Continue Reading
As we learned in the Java String class tutorial, the strings are immutable. That means, once created, a string cannot be changed in Java programming. In certain Continue Reading
In Java, you may use a number of ways to convert numbers (an int, float, double etc.) to string. Following methods can be used for conversion: The Continue Reading
The charAt(int) method returns the character in the specified string for a given index number. The index of string starts at zero. For example, consider this string: Continue Reading
The Java indexOf method returns the index of a given character or substring for the first occurrence in the specified string. The search starts from the beginning Continue Reading
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 Continue Reading
The continue statement is used to skip the current iteration in the for and while loops in Java. In the case of Java for loop, the execution Continue Reading
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. Continue Reading
For string comparison in Java, you may use the equals() and compareTo() methods. There are some differences between the two methods - return values and others as Continue Reading
The issue of string to integer or float (number) conversion is quite common as doing programming in different programming languages and so in Java. For example, as taking Continue Reading
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 Continue Reading
The String replace method of Java is used to replace the existing character(s) in the given string to the new given character(s). A few important points to Continue Reading