Thread: Class help
View Single Post
  #26 (permalink)  
Old 11-15-2007, 06:48 AM
hardwired hardwired is offline
Senior Member
 
Join Date: Jul 2007
Posts: 1,266
hardwired is on a distinguished road
All this
Code:
Account[] accs = new Account[1];
does is to instantiate an array of type Account and length one.
The only (and every) element of the array is null. To initialize the first/only element
you would call a constructor of the Account class. It looks like you did this with
Code:
accs[0] = new Account( "Pauline Smith", 300, 250 ) ;
and got the compile error which is saying that the Account class does not have a
constructor with the signature
Code:
Account(String s, int n1, int n2)
You can add a constructor into the Account class with this signature if you like.
Reply With Quote