Current location: Hot Scripts Forums » Programming Languages » Everything Java » [SOLVED] isLeapYear not working?


[SOLVED] isLeapYear not working?

Reply
  #1 (permalink)  
Old 05-15-04, 01:57 PM
viper2843 viper2843 is offline
New Member
 
Join Date: May 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
[SOLVED] isLeapYear not working?

I am trying to use the isLeapYear function in my program and it doesn't seem to be working. Here is a bit of code:

Code:
Calendar cal = new GregorianCalendar();
boolean leap = cal.isLeapYear(2004);
I am getting the following error when I try to compile it:

Code:
cannot resolve symbol method isLeapYear(int)
All of my other calendar methods are working fine so I don't know what is going on. I am using java sdk 1.4.2_03. Any help would be greatly appreciated. Thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 05-17-04, 11:41 AM
stdunbar stdunbar is offline
Newbie Coder
 
Join Date: Jan 2004
Location: Superior, CO, USA
Posts: 67
Thanks: 0
Thanked 0 Times in 0 Posts
Just define your "cal" variable as a GregorianCalendar, not a Calendar. isLeapYear() is not a method on Calendar, only on GregorianCalendar.



Quote:
Originally Posted by viper2843
I am trying to use the isLeapYear function in my program and it doesn't seem to be working. Here is a bit of code:

Code:
Calendar cal = new GregorianCalendar();
boolean leap = cal.isLeapYear(2004);
I am getting the following error when I try to compile it:

Code:
cannot resolve symbol method isLeapYear(int)
All of my other calendar methods are working fine so I don't know what is going on. I am using java sdk 1.4.2_03. Any help would be greatly appreciated. Thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 05-17-04, 07:11 PM
viper2843 viper2843 is offline
New Member
 
Join Date: May 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
That did the trick. Thanks for your help.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP not working in IIS5 on WinXP Pro cistate ASP 5 06-18-04 03:31 PM
HTTP_REFERER not working Kaikki ASP 6 02-22-04 03:38 PM
calendar working until months changed bitesize JavaScript 1 01-13-04 02:50 PM
If/else statement working...but not working mdhall PHP 13 10-16-03 09:47 AM
can some help me to get this script working cabj1981 ASP 5 09-26-03 11:50 AM


All times are GMT -5. The time now is 09:15 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.