|
Instance Variable Changes with New Object
I'm just learning java and I'm writing a program that compares the frequency of characters in a plaintext document and then in a cipher document. I use the frequencies of the letters in each document to find out which character goes with which, in order to decipher a text file.
I have a class FrequencyAnalysis, which creates an object, with a local variable of char[] key, in which the letters are stored in order of most common occurrence. I create a FrequencyAnalysis object for the plain text document, and the key is stored fine in its array, but when I create a FrequencyAnalysis object for the ciphered text, the key for the plain text document changes to the key for the ciphered document. Why does this happen?
Thanks.
I have attached the two classes, FrequencyAnalysis and then the class FrequencyAnalysisTester which creates the objects to this post.
|