Quantcast
Channel: S. Nageswara Rao, Corporate Trainer – Way2Java
Browsing all 505 articles
Browse latest View live

String Methods Java – toUpperCase() Example

java.lang.String class comes with toUpperCase() method to convert all lowercase letters into uppercase in the string. After modification, a new string is returned with all the conversions. The...

View Article


String Methods Java – trim() Example with screenshot

java.lang.String class comes with trim() method to remove both leading and trailing whitespaces in the string. After trimming, a new string is returned. The signature is given as defined in String...

View Article


String Methods Java – intern() Example

We know the String class maintains a pool of strings. When a new string object is created, its value is placed in the pool. When intern() is called on the existing string object, another new string...

View Article

Java String reverse with and without reverse() Example

To reverse a string with less code in Java, there comes reverse() method in StringBuffer class. reverse() method cannot be used directly on string as reverse() is not defined in String class but...

View Article

Java StringBuffer Methods: append() Example

StringBuffer, with its nature of mutability, comes with many methods that do not exist in String. One useful method is append() method which appends anything to the existing contents. Following is the...

View Article


Java StringBuffer Methods: reverse() Example

StringBuffer comes with many utility methods to do operations on strings apart String class own methods. One such method is reverse() method. StringBuffer, with its nature of mutability, comes with...

View Article

Java StringBuffer Methods: length() Example

StringBuffer comes with many utility methods to do operations on strings apart String class own methods. One such method is length() method. StringBuffer class comes with two methods – length() to find...

View Article

Java StringBuffer Methods: capacity() Example

StringBuffer comes with many utility methods to do operations on strings that do not exist in String class. One such method is capacity() method. StringBuffer class comes with two methods – length() to...

View Article


JSP Handling Client Request Form Data – 3 Ways Example

request is an object of HttpServletRequest and is one of the 9 implicit objects, JSP supports. request object is used to retrieve client’s system (like IP address) information, client’s browser...

View Article


JSP Cookie Handling – Add Cookie, Get Cookie, Cookie Value

Note: You can see the JESSIONID (Session ID) in the output screens at the end. Note: For better understanding, the subject is discussed in Question/Answer format. Note: Before going into this example,...

View Article

Mapping JSP file in web.xml file with alias name

Giving alias name for a JSP file is optional. So far, we have executed all JSPs without alias name by writting the JSP file name in the action attribute of <form> tag. In this code, let us give...

View Article

Java StringBuffer Methods: setLength() Example

StringBuffer setLength(int) method sets the number of characters that can exist in the buffer. What Java API says: public synchronized void setLength(int newLength): sets the capacity for the new...

View Article

Java StringBuffer Methods: charAt() Example

To manipulate string, java.lang.StringBuffer class comes with many methods, otherwise which will take long laborious coding as in C/C++. One such method is charAt(int) that returns the character at the...

View Article


String Methods Java – equals(), equalsIgnoreCase() Example

Comparing Strings First and foremost important operation on strings is to compare whether two strings are same or not. There are three styles which the programmer should be well aware of when to use...

View Article

Java StringBuffer Methods: trimToSize() Example

When the coding comes to an end with string manipulation in the buffer and further no modification is required, keeping extra buffer is memory waste. To remove the extra buffer than required to hold...

View Article


StringBuffer: ensureCapacity Vs setLength Vs trimToSize

Before going into the table, it is advised to refer the programs at: Java StringBuffer Methods: ensureCapacity() Example Java StringBuffer Methods: setLength() Example Java StringBuffer Methods:...

View Article

Java StringBuffer Methods: getChars() Example

Sometimes, it may be needed to copy a few characters of string content of StringBuffer to an array or to copy the complete StringBuffer into an array. Here, getChars() method comes into usage. What...

View Article


Java StringBuffer Methods: setCharAt() Example

To manipulate string, java.lang.StringBuffer class comes with many methods, otherwise, which will take long laborious coding as in C/C++. One such method is setCharAt(int, char) that replaces a single...

View Article

Java StringBuffer Methods: delete() Example

To manipulate string, java.lang.StringBuffer class comes with many methods, otherwise which will take long laborious coding as in C/C++. One such method is delete(int, int) that deletes a group of...

View Article

Java StringBuffer Methods: deleteCharAt() Example

To manipulate string, java.lang.StringBuffer class comes with many methods, otherwise which will take long laborious coding as in C/C++. One such method is deleteCharAt(int) that deletes a single...

View Article
Browsing all 505 articles
Browse latest View live