Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Constructor problem?

 
Sal Velinus
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I run this banking program, I get an error (it compiles ok):

Well, there is such a method. Customer.example1() returns a static instance of the Customer class. It compiled just fine before I changed some other methods, having to do with withdrawals and overdrafts. These withdrawals, etc, are in the TestBanking driver program, but come later in the code. Here's the two code sections, Customer first:

and

Like I said, they worked fine before I changed unrelated methods that come later in the code. What gives? Thanks.
[ April 22, 2002: Message edited by: Greg Adams ]
 
tormod eriksen
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
A general hint.
Look at the linenumber in the errormessage from the compiler. Here: which line has number 98?
From the message it seems there is a problem with a method that does not exist. Do the methods called from example1() (Customer(String), Savings.example1(), Checking.example1()) exist with the number of parameters you call them with? Are the example1() methods in Saving and Checking static?
hth
tormod
 
Sal Velinus
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, they all exist, and all ran fine till I changed other methods that come later in code. Line 98 is bob.accts[0] = ....., which as I say, ran fine before. There's about 4 or 5 files altogether, which is why I don't post them all.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic