This is in my main class and method. I let the user select a character (called a champion), and then ,depending on which character they pick, I want to assign their stats as different values in an array. Each character having different array values imported from a secondary class. I have tried it both declaring the array in the primary class and taking it of either class. I haven't had a lot of progress and wasn't sure where else to look for an answer. Please answer with code, because sometimes I get confused between the different names of things.
if ( champ1 == 0 ){//decides if character has been selected or not System.out.print( "Pick a character:\n"//outputs menu + "1) Miss Fortune\n" + "2) Brand\n" + "3) Annie\n\n" + "Enter your choice: "); champ1 = input.nextInt(); switch(champ1){ case 1: obj.missfortune(); break; case 2: int champarr1[] = new int[7]; obj.annie(champarr1[]); break; case 3: int champarr1[] = new int[7]; obj.brand(champarr1[]); break; default: System.out.println("Invalide entry, try again."); break;
This is my secondary class.
//subclass of reague of regends package reagueofregends; public class Characters { public int[] champ = new int[5]; public int[] missfortune(){ int[] champ = {1,2,3,4,5,6,7}; return (champ); } public void annie(int[] champ){ int[] champ = {1,2,3,4,5,6,7}; } public void brand(int[] champ){ int[] champ = {1,2,3,4,5,6,7}; } }