Java String
Chapter:
Miscellaneous
Last Updated:
21-07-2016 18:34:42 UTC
Program:
/* ............... START ............... */
public class JavaStringExample {
public static void main(String args[]) {
char[] array= { 'J', 'A', 'V', 'A', 'S', 'C', 'A', 'N' };
String string = new String(array);
System.out.println(string);
}
}
/* ............... END ............... */
Output
Notes:
-
String is an object that represents sequence of char values.
- Java String provides operations such as compare, concat, equals, split, length, replace, compareTo, intern, substring etc.
- The java String is immutable i.e. it cannot be changed but a new instance is created.
Tags
String, Java