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

qt - QML MouseArea onWheel event not working properly when inside QML Scrollview -

java - is not an enclosing class / new Intent Cannot Resolve Constructor -

python - Error importing VideoFileClip from moviepy : AttributeError: 'PermissionError' object has no attribute 'message' -