If you look at my code below, can you tell me what is happening when I make a static FileReader file, then set file = new FileReader(fileName) each time I open a file. Does it make sense for FileReader file to be static? I realize that by making file static, I will only ever have one instance of file, but is this efficient or smart coding?
Originally posted by Eric Gero: I realize that by making file static, I will only ever have one instance of file
That's not true. You will only have one shared "file" variable, but that's only the *reference*. Every time you call a constructor (such as the new FileReader... in your code), you are creating a new object.
Making the variable a static field won't do you any good at all.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus