fetching even items from a list java

Solutions on MaxInterview for fetching even items from a list java by the best coders in the world

showing results for - "fetching even items from a list java"
Angela
18 Sep 2016
1public class OddEvenInArrayExample{  
2public static void main(String args[]){  
3int a[]={1,2,5,6,3,2};  
4System.out.println("Odd Numbers:");  
5for(int i=0;i<a.length;i++){  
6if(a[i]%2!=0){  
7System.out.println(a[i]);  
8}  
9}  
10System.out.println("Even Numbers:");  
11for(int i=0;i<a.length;i++){  
12if(a[i]%2==0){  
13System.out.println(a[i]);  
14}  
15}  
16}} 
similar questions
queries leading to this page
fetching even items from a list java