Sunday, 18 August 2013

cannot find symbol (doesn't recognize methods inside GregorianCalendar)

cannot find symbol (doesn't recognize methods inside GregorianCalendar)

Issue:
CalendarTest.java:9: error: cannot find symbol
int today = d.get(Calendar.DAY_OF_MONTH);
^
symbol: method get(int)
location: variable d of type GregorianCalendar
My code:
import java.util.*;
public class CalendarTest
{
public static void main(String[] args)
{
GregorianCalendar d = new GregorianCalendar();
int today = d.get(Calendar.DAY_OF_MONTH);
}
}
So, what I've done so far was checking the API (methods get and set won't
work at all). I've also been searching stackoverflow and google to get
some help about the issue, but without any positive results.
Tried switching between Java 6 and Java 7 without any result at all. Been
doing this for Calendar instead of GregorianCalendar, but the problem
still remains.
I'm operating on Ubuntu 12.04. I've no clue what's wrong since those
methods are included in GregorianCalendar class (as far as API says so)
Also,
CalendarTest.java:8: error: constructor GregorianCalendar in class
GregorianCalendar cannot be applied to given types;
GregorianCalendar asd = new GregorianCalendar(2000, 10, 25);
^
required: no arguments
found: int,int,int
reason: actual and formal argument lists differ in length
won't work as well. It says that parameters (int, int, int) are wrong.
Well it shouldn't, should it?
Please help me get past this, since I can not move any further (doing Core
JAVA 2 Basics)

No comments:

Post a Comment