Most of the necessary introduction to arrays is in the last section of Chapter 4, which shows how you define and initialize an array. Holding objects is the focus of this chapter, and an array is just one way to hold objects. But there are a number of other ways to hold objects, so what makes an array special?
Latest Thinking In Java Articles - Page 6
To summarize what we’ve seen so far, your first, most efficient choice to hold a group of objects should be an array, and you’re forced into this choice if you want to hold a group of primitives. In the remainder of the chapter we’ll look at the more general case, when you don’t know at the time you’re writing the program how many objects you’re going to need, or if you need a more sophisticated way to store your objects. Java provides four types of collection classes to solve this problem: Vector , BitSet , Stack , and Hashtable . Although compared to other languages that provide collections this is a fairly meager supply, you can nonetheless solve a surprising number of problems using these tools.
Polymorphism means “different forms.” In object-oriented programming, you have the same face (the common interface in the base class) and different forms using that face: the different versions of the dynamically-bound methods.
In Chapter 6 you saw how an object can be used as its own type or as an object of its base type. Taking an object handle and treating it as the handle of the base type is called upcasting because of the way inheritance trees are drawn with the base class at the top.
Latest Developer VideosMore...
Latest CodeGuru Developer Columns
The Transactional File System (TxF), which allows access to an NTFS file system to be conducted in a transacted manner through extensions to the Windows SDK API. MFC 10, has been extended to support TxF and related technologies. This support allows existing MFC applications to be easily extended to support kernel transactions.
Did you ever stop to thoroughly explore some of the more esoteric types, Lists and Stacks, that are available in the .NET collections namespace?
Learn how to make your own usable .NET Component with Visual Basic.
Arun Karthick introduces you to the state machine model and shows you how to create a simple working state machine sample using the .NET framework in the C# language.