-1

here is the error:

Error: Main method not found in class nPack.Try, please define the main method as: public static void main(String[] args) or a JavaFX application class must extend javafx.application.Application

I already have the main method what is wrong?I've been sitting for 2 hours and I can't figure out what's going on. I restarted IDEA but it still doesn't work(

here is my code:


class SearchInfo {
        class Search{
            public static void main(String[] args) throws IOException {
                System.out.println("please sign up: ");
                chooseUser();
            }
            public static String chooseUser()throws IOException {
                Scanner sc= new Scanner(System.in);

                System.out.println("Choose your specialization: ");
                System.out.println("1) Sale manager: ");
                System.out.println("2) Client: ");
                do{
                    System.out.print("Your choose: ");
                    String choose = sc.nextLine();
                    switch(choose){
                        case "sale manager":
                        case "manager":
                        case "worker":
                        case "Manager":
                        case "1":
                            System.out.println("Welcome company employee: ");
                            System.out.println("Write your login and password: ");
                            /*workerInputLgPw();*/
                            break;
                        case "Client":
                        case "client":
                        case "2":
                            System.out.println("Welcome our client: ");
                            System.out.println("Write your login and password: ");
                            /*clientInputLgPw();*/
                            break;
                        default:
                            System.out.println("Кто ты воин?");
                            System.out.println("Logout [1] or retry[0]? ");
                            int ex = sc.nextInt();
                            if (ex == 0){
                                chooseUser();
                            }
                            else if(ex == 1){
                                System.exit(0);
                            }
                    }
                    break;
                }while(true);
                return "";
            }
        }
    }
John Kugelman
  • 349,597
  • 67
  • 533
  • 578
  • 1
    You don't have a class named `nPack`. You also have nested your `Search` class inside your `SearchInfo` class. You probably don't want to do that. Remove one of those `class Xxxx {` lines and the matching `}` and just have a single class. – tgdavies Dec 19 '22 at 06:36
  • 1
    ... and make sure that the name of the class matches the name of the file it is defined in ... or you will get more errors. – Stephen C Dec 19 '22 at 06:38

1 Answers1

-1

Move your main method from Search class to the SearchInfo class.