java - can not find symbol method Iterator() -


hello have started learning collection in java , trying write simple program getting 2 errors please have , me out.

import java.util.iterator; import java.util.*;     class arraylistdemo1{     public static void main(string... s){     arraylist<integer> al = new arraylist<integer>();  // arraylist al = new arraylist();     int x[] = {1, -1, 2, -2, 3, -3, 4, -4};     for(int i=0; i<x.length;i++){         al.add(x[i]);     }     system.out.println(al); //  iterator<integer> = al.iterator();     iterator = al.iterator();     while(i.hasnext()){         integer z = (integer)i.next(); //      integer z = i.next();         if(z.intvalue < 0)           i.remove();      }        system.out.println(al); } } 

 1. iterator = al.iterator();//here method case sensitive  2. intvalue() not intvalue, method. 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -