N
N
Neonoviiwolf2017-02-10 15:26:49
Java
Neonoviiwolf, 2017-02-10 15:26:49

What's not to like about ArrayList?

Good!
Simple question but can't figure out the problem. There is an array of strings, I want to fill it with data, but I don’t understand the errors

private ArrayList<String> dataList = new ArrayList<>();
publick void myFun ()
{
        for (int i = 0; i<2; ++i)
            dataList.add(null);
        String s = "ss";
        dataList.get(0) =s; //не нравится эта строчка, подчёркивает красным

error:
Error:(45, 21) error: unexpected type
required: variable
found: value

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
gleendo, 2017-02-10
@Neonoviiwolf

null = "ss"; // ERROR

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question