Chapter 4. Arrays and Strings
In this chapter you'll start to use Java objects. You'll first be introduced to arrays, which enable you to deal with a number of variables of the same type through a single variable name, and then you'll look at how to handle character strings. By the end of this chapter you'll have learned:
What arrays are and how you declare and initialize them
How you access individual elements of an array
How you can use individual elements of an array
How to declare arrays of arrays
How you can create arrays of arrays with different lengths
How to create String objects
How to create and use arrays of String objects
What operations are available for String objects
What StringBuffer objects are and how they relate to operations on String objects
What operations are available for StringBuffer objects
Some of what I discuss in this chapter relates to objects, and as I have not yet covered in detail how you define a class (which is an object type definition), I will have to skate over some aspects of how objects work, but all will be revealed in Chapter 5.
Get Ivor Horton's Beginning Java™ 2, JDK™ 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.