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.
The original release of the .NET Framework included collections as .NET was introduced to the Microsoft programming world. The .NET Framework 2.0 introduced generics to complement the System.Collections namespace and provide a more efficient and well performing option. Read on to learn more...
Learn how to use a for loop to loop through all of the images found on a web page and save them via the DownloadFile method of the WebClient object.
SOLID principles form the base for writing good and clean object oriented code in C#. Learn about the S.O.L.I.D principles and explore C# coding samples for each.