Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Cant see why this doesnt work?

$
0
0
 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)

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>