Can't find createAccount symbol in BankAccount project

I'm new to Java and creating this class which calls another class named BankAccount, and I'm getting the "cannot find symbol" error when I compile, the method is right below my main. Any help would be great, thanks.

import java.util.Scanner;
public class InClass
{
    public static void main (String []args)
    { 
        BankAccount account;

        account = new createAccount();

    }

    public BankAccount createAccount() 
    {
        Scanner kb = new Scanner (System.in);   //input for Strings
        Scanner kb2 = new Scanner (System.in);  //input for numbers
        String strName;                         //Holds account name
        String strAccount;                      //Holds account number
        String strResponse;                         //Holds users response to account creation
        double dDeposit;                        //Holds intial deposit into checking
        BankAccount cust1;

        System.out.print ("\nWhat is the name of the account? ");
        strName = kb.nextLine();
        while (strName.length()==0)
        {
            System.out.print ("\nPlease input valid name.");

            System.out.print ("\nWhat is the name of the account?");
            strName = kb.nextLine();
        }

        System.out.print ("\nWhat is your account number?");
        strAccount = kb.nextLine();
        while (strAccount.length()==0)
        {
            System.out.print ("\nPlease enter valid account number.");
            System.out.print ("\nWhat is your account number?");
            strAccount = kb.nextLine();
        }

        ......

        return cust1;
 }
Jon Skeet
people
quotationmark

This is the problem:

account = new createAccount();

That's not trying to call a method called createAccount - it's trying to call a constructor of a type called createAccount, and you don't have such a type.

You could write:

account = createAccount();

... but then that would fail because createAccount is an instance method instead of a static method (and you don't have an instance of InClass to call it on). You probably want it to be a static method.

As a side-note, I'd strongly recommend that you declare variables just at the point of first use, and get rid of the pseudo-Hungarian notation e.g.

String name = kb.nextLine();

instead of:

String strName;
...
strName = kb.nextLine();

In Java, you don't need to declare all your local variables at the top of a method - and doing so hurts readability.

people

See more on this question at Stackoverflow