September 2005
Beginner
576 pages
13h 6m
English
At the insistence of every attorney and management executive in the Pearson family of computer publishers, the workshop for this hour will not be the creation of a working virus program. Instead, you'll create a simple Virus object that can do only one thing: count the number of Virus objects that a program has created and report the total.
Load your word processor and create a new file called Virus.java. Enter Listing 11.1 into the word processor and save the file when you're done.
1: public class Virus {
2: static int virusCount = 0;
3:
4: public Virus() {
5: virusCount++;
6: }
7:
8: static int getVirusCount() {
9: return virusCount;
10: }
11: }
|
Compile ...
Read now
Unlock full access