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
Quirky and yet persistent, C++ is a language that keeps programmers coming back to it. Pick up some new ways to wrangle it into your workflow.
Just a few lines of code will let your program determine whether it's being reached by a mobile device.
Pick up the basics of how to create dynamic assemblies and how to run dynamic code.
As a web developer you should be aware of a few security best practices while developing your ASP.NET web application. Arun Karthick lists his top 7 tips to help you keep your ASP.NET security intact.