java - For Loop is not running, -


my loop in code being ignored, tested without if statement, , still loop doesn't output when call main method.

public void searchbatsmenid(int id){     (batsmen check : batsmen) {        exists = false;        if (check.id == id && id!=0){            system.out.println("player id: " + check.id);            system.out.println("name: " + check.name);            system.out.println("age: " + check.age);            system.out.println("number of matches played: " + check.matches);            system.out.println("runs scored: " + check.runs);            system.out.println("");            exists = true;         }     } 

assuming not getting error,there 2 possible reason for loop not being able run...

1>. there no element in batsmen,i.e size zero.to check this,print before if statement.

2>.if (check.id == id && id!=0) false.


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -