Submitted by heartin on Tue, 08/21/2012 - 08:06
The Character class is a wrapper class for the char primitive data type.
Submitted by heartin on Tue, 08/21/2012 - 08:20
String interning is a method of storing only one copy of each distinct string value, which must be immutable. The distinct values are stored in a string intern pool. The single copy of each string is called its 'intern' and is typically looked up by a method (e.g. String.intern() in Java.).
Submitted by heartin on Tue, 08/21/2012 - 09:12
Data with other data types can be converted to String using explicit and automatic ways in Java. Explicit String conversion ways include:
- Use of the toString() method of an object, especially wrapper classes.
- Use of the static overloaded method String.valueOf, passing in the other data type value.
- Use of a String constructor to convert a byte array as a String.
Submitted by heartin on Tue, 08/21/2012 - 09:50
We will discuss String Replace and String Split in Java with some examples. String replace is the process by which we replace parts of a string with another string. Some Java methods directly accept character sequences, while some others accept a regular expression (regex). We will discuss some of these approaces using examples. String split is the process by which a string is split around a delimiter.
Submitted by heartin on Wed, 08/22/2012 - 03:59
Strings are immutable and a new String object is created every time you modify a Sring object. A StringBuffer is a thread-safe, mutable sequence of characters. A StringBuilder is similar to StringBuffer, but with no guarantee of synchronization.
Submitted by heartin on Sat, 08/25/2012 - 01:18
Java doesn't allow operator overloading yet + is overloaded for class String. Here we will discuss examples for use of + with Strings and characters.
Submitted by heartin on Fri, 02/14/2014 - 07:52
A String is a sequence of characters (e.g. "Hello World").
A String is an object in java, and not a primitive.
We can create a String object in two ways:
Assigning a String literal to a String variable
Submitted by heartin on Wed, 08/06/2014 - 10:45
String interning is a method of storing only one copy of each distinct string value. Strings in Java are immutable and hence this sharing is perfectly safe and give you better performance. The distinct values are stored in a fixed-size hashtable usually referred to as string intern pool or string pool. The single copy of each string is called its 'intern'. You can read more about the basics of String interning with examples @ string-interning-in-java-with-examples.