java - Cannot get array to store input in next array slot -
i'm creating banking system , can't seem store name of customer names in array. last customer name overridden on next customer. these lines concerning array.
arraylist<string> allnames1 = new arraylist<string>(); system.out.println("please enter account holders name:"); allnames1.add(sc.nextline()); system.out.println("account created. overview , balance: " + "\n" + allnames1);
after happens user taken "main menu" in class.
allnames1.add ("a")
allnames1.add ("b") enough.
if doesn't work; think because allnames1 newly created every time.. or sc.nextline wrong.
Comments
Post a Comment