O'Reilly logo

Ivor Horton's Beginning Java™ 2, JDK™ 5th Edition by Ivor Horton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required