Java: initialization problem, cannot print "assigned" values from arrayList

Posted by HH on Stack Overflow See other posts from Stack Overflow or by HH
Published on 2010-04-11T01:48:47Z Indexed on 2010/04/11 2:53 UTC
Read the original article Hit count: 257

$ javac ArrayListTest.java 
$ java ArrayListTest 
$ cat ArrayListTest.java 
import java.io.*;
import java.util.*;

public class ArrayListTest{

    public static void main(String[] args) {
        try {
            String hello ="oeoaseu oeu hsoae sthoaust hoaeut hoasntu";
            ArrayList<String> appendMe = null;

            for(String s : hello.split(" "))
                appendMe.add(s+" ");

            for(String s : appendMe)
                System.out.println(s);
            //WHY DOES IT NOT PRINT?
        }catch(Exception e){
        }
    }
}

© Stack Overflow or respective owner

Related posts about java

Related posts about arraylist