public String AccountNameFinder(LinkList AccountList,int AccountNum1) { String PassBackName = "No Name"; //for loop wont work for( LinkNode<E> n = head; n != null; n=n.next ) { Account p = (Account) n.elem; if((p.getAccountNumber())==(AccountNum1)) { PassBackName = p.getName(); } } return PassBackName; }
No error shows up, the things that are being passed in work.
But when it gets to the for loop it pops back to the main method.
Any ideas why it wont work? outside in the method i call it from I have:
String Name = AccountNameFinder(AccountList, AccountNum1)