Arrays and Strings

"First things first, but not necessarily in that order."
—Doctor Who


Hopefully, you now have a reasonably good understanding of the basics of Java coding and are fairly comfortable using primitive data types, conditional statements, loops, and methods. In this chapter we first take a look at arrays, their importance in programming, and how they are used in Java. We then delve into strings, where you will learn about the String class and other useful string-related classes, such as the StringBuffer and StringTokenizer. We have already looked very briefly at objects at the beginning of the previous chapter with the Person class but have yet to use objects properly in any code examples. In Java, arrays and strings are objects, which means we are now about to start using objects for the first time. This should also provide us with a solid introduction in preparation for , "Multiple Classes."