CIS 35A: Introduction to Java Programming

Home | Green Sheet | Lectures | Assignments | FAQ | Grades

Dates

Dates and Strings
String class
Constructors

The String class

java.lang.String

A String object is immutable; its contents cannot be changed.

Common constructors of the String class

Constructor Description
String() Creates an empty string ("").
String(arrayName) Creates a string from an array of char or byte types.
String(arrayName, intOffset, intLength) Creates a string from a subset of an array of char or byte types. The characters referred to by intOffset and intLength must fall within the array, or the constructor will throw an exception.

Previous | Constructors | Create strings | Methods | Code | Next