heartin's blog

String Replace and String Split in Java with Examples

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. 

Explicit and Automatic String Conversion in Java

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.

 

String Interning in Java with Examples

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.).

Char and Character Class in Java

The Character class is a wrapper class for the char primitive data type.

Explaining Access Modifiers with Example Code

We have discussed the theory about access modifiers in the previous note. This note will give you an example code that will show the valid and invalid usages for members belonging to different access levels from different regions of your code such as same class, subclass in same package, subclass in another package and a non-subclass in another package.  

Pages

Search the Web

Custom Search

Searches whole web. Use the search in the right sidebar to search only within javajee.com!!!