Error is coming in Arraylist 's list.add()

后端 未结 3 1904
星月不相逢
星月不相逢 2021-01-14 03:42

I am using Eclipse JUno ,I am having trouble with the .add() of the arraylist guys please help.here is my code

     import java.util.ArrayList;
public class          


        
3条回答
  •  温柔的废话
    2021-01-14 03:46

    Works great with JDK 6

    public static void main(String[] args) {
                ArrayList list=new ArrayList();
                list.add(90);
                list.add(9.9);
                list.add("abc");
                list.add(true);
                System.out.println(list);
        }
    

    Printed result :[90, 9.9, abc, true].

    If still you are using lesser version than jdk 6.Please specify version.

提交回复
热议问题