Java Bank Account
Demo of Program Execution
Screen Shot of Directory Listing
Screen Shot of Sample Execution
Detailed description:
"Now let's take a look at
the bank account and run a sample of it so you get an idea of what's going
to take place. Then we'll walk through the code.
First were going to bring
up a window that we can type into. I'm going into a
specific directory that is called JavaProg and into the sample's subdirectory
and into the bank account directory. So I'm several levels deep inside
the various directory structures. In this subdirectory is the bank account
source code that we're going to be running, and there's also the bank account's
class .class file, which is the byte code.
To run Java, we just type in the
java command and type in BankAccount. As we type it in, we
must remember that when we run a program written in Java using the java
command, which is called a Java application, we're going to execute it
without specifying the file suffix. So we'll just type in java
BankAccount. Once we hit enter, the program will run.
The Java virtual machine starts and
it loads in the program and runs it. As you
see on the screen now, 'a' and 'b' are BankAccounts, and they have
balances of $15.25 and $0.00. Those are our initial values for this
bank account. And in the sample code, you'll see that we'll actually
modify those accounts and we have two more lines. Those are the final
lines, where 'a' and 'b' now have $9.75 and $125.99.
It's a very simple application, but
it gives you an idea that we can run some code and the code happens to
be written Java. That's our first step."
|