How to Convert Character array into String

char array can be converted into String by passing char array as an argument in the constructor of String. The below demo program illustrates how to Convert Character array into String.

public class ConvertCharacterArrayToString {

	public static void main(String[] args) {

		char[] charArray = { 'h', 'e', 'l', 'l', 'o', 'w','o','r','l','d' };
		String helloWorldString = new String(charArray);


Output of the above program is:


ArrayList in Collection

ArrayList in Collection

1. ArrayList can be instantiated as below:

                                 List list = new ArrayList();

2. Default initial Capacity of ArrayList = 10

3. New Capacity of ArrayList When ArrayList becomes full = (Current Capacity*3/2) +1

4. Every Collection class already implements Serializable and Cloneable interface.

5. ArrayList classes implement RandomAccess interface so that any random element we can access with same speed.

6. RandomAccess interface present in util package and doesn’t contain any methods. It is a marker interface.