This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman 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 Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Constructor problem?" Watch "Constructor problem?" New topic
Author

Constructor problem?

Sal Velinus
Greenhorn

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:

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

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

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.
 
rocket mass heater kickstarter
 
subject: Constructor problem?