即使头文件中存在列表,仍然无法正常工作,为什么?

时间:2019-06-20 18:27:49

标签: java

import java.util.*;

public class HiBhai

{
    public static void main (String[] args)

    {
        List list = new ArrayList();

        list.add = ("Mumbai");

        list.add = ("Baple");

        list.add = ("Alibag");

        list.add = ("Nagpur");

        list.add = ("Pune");

        System.out.println(list.toString());    
    }
}

1 个答案:

答案 0 :(得分:0)

import java.util.*;

public class HiBhai

{
    public static void main (String[] args)

    {
        List list = new ArrayList();

        list.add("Mumbai");

        list.add("Baple");

        list.add("Alibag");

        list.add("Nagpur");

        list.add("Pune");

        System.out.println(list.toString());    
    }
}