‹header›
‹date/time›
Click to edit Master text styles
Second level
Third level
Fourth level
Fifth level
‹footer›
Chapter 16-‹#›
The two most important concepts in object-oriented programming are the class and the object. In the broadest term, an object is a thing, both tangible and intangible, which we can imagine. A program written in object-oriented style will consist of interacting objects. For a program to maintain bank accounts for a bank, we may have many Account, Customer, Transaction, and ATM objects.
An object is comprised of data and operations that manipulate these data.
The two most important concepts in object-oriented programming are the class and the object. In the broadest term, an object is a thing, both tangible and intangible, which we can imagine. A program written in object-oriented style will consist of interacting objects. For a program to maintain bank accounts for a bank, we may have many Account, Customer, Transaction, and ATM objects.
An object is comprised of data and operations that manipulate these data.
In pseudocode the above method is expressed as follows:
public void directoryListing( File dir )
{
//assumption: dir represents a directory
fileList = an array of names of files and
subdirectories in the directory dir;
for (each element in fileList) {
if (an element is a file) {
output the element’s filename;  //end case: it’s              //a file.
}
else { //recursive case: it’s a directory
call directoryListing with element as an argument;
  }
}
}
In pseudocode the above method is expressed as follows:
public void directoryListing( File dir )
{
//assumption: dir represents a directory
fileList = an array of names of files and
subdirectories in the directory dir;
for (each element in fileList) {
if (an element is a file) {
output the element’s filename;  //end case: it’s              //a file.
}
else { //recursive case: it’s a directory
call directoryListing with element as an argument;
  }
}
}
In pseudocode the above method is expressed as follows:
public void directoryListing( File dir )
{
//assumption: dir represents a directory
fileList = an array of names of files and
subdirectories in the directory dir;
for (each element in fileList) {
if (an element is a file) {
output the element’s filename;  //end case: it’s              //a file.
}
else { //recursive case: it’s a directory
call directoryListing with element as an argument;
  }
}
}
In pseudocode the above method is expressed as follows:
public void directoryListing( File dir )
{
//assumption: dir represents a directory
fileList = an array of names of files and
subdirectories in the directory dir;
for (each element in fileList) {
if (an element is a file) {
output the element’s filename;  //end case: it’s              //a file.
}
else { //recursive case: it’s a directory
call directoryListing with element as an argument;
  }
}
}