Java – why not ArrayList < > Add() work?

I'm new to Java. I'm currently using Android studio I just can't understand why Add does not work Topics and jobs are just custom classes The problem is that the message "unable to parse symbol 'Add' pops up, and the whole process fails I imported Java util. ArrayList.

ArrayList<Subject> mSubjects = new ArrayList<Subject>();
Subject cheese = new Subject("Cheese",new Assignment[]{new Assignment("Test 1",1.0f,1.0f),new Assignment("Test 2",100f,1.0f)},4.0f);
mSubjects.add(cheese);

Solution

mSubjects.add(cheese);
mSubjects.add(cheese);

Put this method in the oncreate method

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>