Wednesday, February 1, 2012

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException

Solution:

For Array

    public class LoopExample {
        public static void main(String[] args) {
            int[] primes = {2, 3, 5, 7, 11, 13, 17, 19};
            for(int p : primes) {
                System.out.println(p);
            }
        }
    }
    http://java.sun.com/j2se/1.5.0/docs/...e/foreach.html

    For ArrayList

             Iterator iter = m_oAccList.iterator();
                while (iter.hasNext()) {
                  System.out.println("string " +  iter.next());
                  }
     
    Post a Comment
    Related Posts Plugin for WordPress, Blogger...