Original Post
I've never really understood why constructors are necessary. Could someone explain to me why they are needed and what EXACTLY do they do?
Thanks,
Morley
Thanks,
Morley
Sentence mySentence = new Sentence();
String theWordsInMySentence = mySentence.getText(); // uh oh getText has not returned any words!Sentence mySentence = new Sentence("Hello this is my sentence.");
String theWordsInMySentence = mySentence.getText(); // yay, no longer returning invalid results
public class Test {
static final int a = 1;
static final int b = 2;
}Test t = new Test();
This topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more