I have an error in one of the case
s of switch
, the error is this:
I'mdoingaCRUDfromalibrary,whenyouseethecode,youmightfinditstrange:
I'vemadesomeswitch
withonly1option,becauseeachoptionleadstoadifferentmenu
@OverridepublicintMenu(intmenu){intopc=0;System.out.println("-======MENU======-\n\n" +
"1. Cadastrar\n" +
"2. Editar\n" +
"3. Pesquisar\n" +
"4. Listar\n" +
"5. Excluir\n" +
"6. Excluir tudo\n" +
"7. Sair");
return opc;
}
The first option goes to the register menu, the second one goes to the edit menu ... so I thought it best to make a switch
with an option for each menu.
I will make the code available to you on my GitHub, as it is too long to put here, the error is in the Main class, more specifically in line 198, where you have written:
The error happens exactly here:
case 2 : {
Biblioteca.MenuEditar(opc);
}