Le Jingle
2012-11-15 22:31:02
I'm trying to make a char counter for a given text file in java.
I've a pretty good idea on how to accomplish this, however I'm stuck when a requirement is to have a constructor in the class named differently from the class name?
Ex.
Edit: I may have read the question wrong, as I've come across several sources saying you must have the same name as the class..
If I want to use letterCounter later on, as if I wanted to call such a line as:
Can I do this with methods (so I can use different names)?
I've a pretty good idea on how to accomplish this, however I'm stuck when a requirement is to have a constructor in the class named differently from the class name?
Ex.
public class LetterCounter {
public LetterInventory() {
//
}
}
Edit: I may have read the question wrong, as I've come across several sources saying you must have the same name as the class..
If I want to use letterCounter later on, as if I wanted to call such a line as:
LetterInventory inventory = new LetterInventory();
– > how would I go about this? I thought that I had to create a construct and store the values inside that construct?Can I do this with methods (so I can use different names)?