"cannot find symbol method add(java.util.Date)" -
i'm getting error "cannot find symbol method add(java.util.date)", although i'm passing declared date. missing?
import java.util.*; import java.text.simpledateformat; import java.text.*; class entry { date date; entry(date adate) { date = adate; } } public class td { public static void main(string[] args) { list<entry> entries = new arraylist<entry>(); dateformat df = new simpledateformat("yyyy-mm-dd"); date adate = df.parse("2011-02-27"); // date adate = new date() fails entries.add(adate); system.out.println(entries.get(0)); } }
are sure want not entries.add(new entry(adate));
? seems purpose of entry
class.
and speaking, if declare list list<entry>
, should store entry
instances in it, not date
.
also, error says "cannot find symbol method add(java.util.date)" . so, it's not date
class that's missing. it's add(java.util.date)
method.
Comments
Post a Comment