Greetings Tek-Tips, so, i'm a first time Java users, I downloaded 1.4.2 SDK and installed it, I also downloaded Jcreator to write my code in.
So, I have a little program that i'm trying to make work, and here it is
/**
A bank account has a balance that can be changed by
deposits and withdrawals.
*/
public class BankAccount
{
/**
Constructs a bank account with a zero balance
*/
public BankAccount()
{
balance = 0;
}
/**
Constructs a bank account with a given balance
@param initialBalance the initial balance
*/
public BankAccount(double initialBalance)
{
balance = initialBalance;
}
/**
Deposits money into the bank account.
@param amount the amount to deposit
*/
public void deposit(double amount)
{
double newBalance = balance + amount;
balance = newBalance;
}
/**
Withdraws money from the bank account.
@param amount the amount to withdraw
*/
public void withdraw(double amount)
{
double newBalance = balance - amount;
balance = newBalance;
}
/**
Gets the current balance of the bank account.
@return the current balance
*/
public double getBalance()
{
return balance;
}
private double balance;
}
Now, it complies no problem, but when I try to execute it, a command window pops up (like it should) and it tells me this...
Exception in the thread "main" java.lang.NoSuchMethodError: main
Press any key to continue
And when a key is pressed, the window disapears.
So basically I can't see what happens with my program, and I have no idea how to fix it.
Any help would be terrific. Thanks
So, I have a little program that i'm trying to make work, and here it is
/**
A bank account has a balance that can be changed by
deposits and withdrawals.
*/
public class BankAccount
{
/**
Constructs a bank account with a zero balance
*/
public BankAccount()
{
balance = 0;
}
/**
Constructs a bank account with a given balance
@param initialBalance the initial balance
*/
public BankAccount(double initialBalance)
{
balance = initialBalance;
}
/**
Deposits money into the bank account.
@param amount the amount to deposit
*/
public void deposit(double amount)
{
double newBalance = balance + amount;
balance = newBalance;
}
/**
Withdraws money from the bank account.
@param amount the amount to withdraw
*/
public void withdraw(double amount)
{
double newBalance = balance - amount;
balance = newBalance;
}
/**
Gets the current balance of the bank account.
@return the current balance
*/
public double getBalance()
{
return balance;
}
private double balance;
}
Now, it complies no problem, but when I try to execute it, a command window pops up (like it should) and it tells me this...
Exception in the thread "main" java.lang.NoSuchMethodError: main
Press any key to continue
And when a key is pressed, the window disapears.
So basically I can't see what happens with my program, and I have no idea how to fix it.
Any help would be terrific. Thanks