0

Can someone please tell me the error? I am new to Java.

package bankapplication;
import java.util.Scanner;

public class mainmenu {
    static Scanner in = new Scanner(System.in);

    public void main() {
        createanaccount accountObject = new createanaccount();
        viewaccount viewObject = new viewaccount();

        System.out.println("Select an option");

        System.out.println("1\t Create an account");
        System.out.println("2\t View an account");
        System.out.println("3\t Quit");
        int option = in.nextInt();

        switch (option) {
            case 1: accountObject.createanaccount() ; {
            }

            case 2: viewObject.viewaccount() ;{
            }

            case 3: System.exit(3); {
            }
        }
    }
}
Antti29
  • 2,953
  • 12
  • 34
  • 36
salman
  • 53
  • 2
  • 7
  • 1
    Please format your code... - Besides that, the signature for `main()` is wrong. It needs to be `public void main(String[] args)` or `public void main(String... args)` (which practially is the same). – Thomas Feb 19 '16 at 11:11
  • 2
    Possible duplicate of [What does "Could not find or load main class" mean?](http://stackoverflow.com/questions/18093928/what-does-could-not-find-or-load-main-class-mean) – Thomas Kläger Feb 19 '16 at 11:16
  • 1
    the main has also to be static AFAIK –  Feb 19 '16 at 12:37
  • @Thomas Well, both suggestions are wrong :P. Like RC. already wrote: `main` is a `static` method. – Tom Feb 19 '16 at 12:52

1 Answers1

0

Hi Salman what Icould figure out of your code was your main body shoul look some what like this :

 public static void main(String[] args){

}

And I think you need import statements for createanaccount and viewanaccount class