This is my class
import java.io.*;
public class bankAccount
{
//instance variables
public String name;
public int number;
public double balance;
public double deposit;
//constructor
public bankAccount(String name, int number, double balance, double deposit)
{
this.name = "John Smith";
this.number = 123456;
this.balance = 0.0;
}
public double getBalance()
{
return balance;
}
public void getDeposit(double deposit)
{
balance+=deposit;
}
public String toString()
{
return "Name:" + name + "\n number:" + number + "\n balance = " + getBalance();
}
}
and my main
import java.io.*;
public class testBank
{
public static void main(String[] args)
{
bankAccount b;
b = new bankAccount();
System.out.println(b.toString());
}
}
I get the error "cannot find symbol" at the b=new bankAccount() part of the main. Apparently, the symbol is the bankAccount constructor.
Why won't this compile?
I know I'm not really some of the methods in my first class, but Im trying to fix this problem first.