Why isn't the "this." command needed in this constructor? (java)
- by David
I'm reading a book about java. It just got to explaining how you create a class called "deck" which contains an array of cards as its instance variable(s). Here is the code snippit:
class Deck {
Card[] cards;
public Deck (int n) {
cards = new Card[n];
}
}
why isn't the this. command used?
for example why isn't the code this:
class Deck {
Card[[] cards;
public Deck (int n) {
this.cards = new Card[n];
}
}