This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Constructor problem? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Constructor problem?" Watch "Constructor problem?" New topic

Constructor problem?

Sal Velinus

Joined: Mar 05, 2002
Posts: 25
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:


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

Joined: Jan 23, 2002
Posts: 52
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?
Sal Velinus

Joined: Mar 05, 2002
Posts: 25
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.
I agree. Here's the link:
subject: Constructor problem?
It's not a secret anymore!