Results 1 to 4 of 4
- 05-07-2008, 08:16 AM #1
cannot call private method from static method
Any idea how to resolve this?
:eek:
import java.util.*;
public class DateLib {
private final long DAYS_TO_HOURS = 24L;
private final long HOURS_TO_MINUTES = 60L;
private final long MINUTES_TO_SECONDS = 60L;
private final long SECONDS_TO_MILLISECONDS = 1000L;
public static long getMillisecondsFromEpoch (int aYear, int aMonth, int aDay) {
/*
* Epoch is January 1, 1970 00:00.00 000 GMT
*/
//TODO calculate no of Years to milliseconds
final long Year = (((long) aYear) - 1970L);
if (!(isLeapYear)) {
// ERROR: Exception in thread "main" java.lang.Error: Unresolved compilation //problem: isLeapYear cannot be resolved
}
else {
}
return Year;
}
public static long getMillisecondsFromEpoch (int aYear, int aMonth, int aDay,
int aHour, int aMinute, int aSecond)
{
/* TODO **
* Epoch is January 1, 1970 00:00.00 000 GMT
*/
return 0L;
}
private boolean isLeapYear (int aYear) {
/*
* if year modulo 400 is 0 then leap
* else if year modulo 100 is 0 then no_leap
* else if year modulo 4 is 0 then leap
* else no_leap
* (Source: Leap year - Wikipedia, the free encyclopedia)
*/
if ((aYear % 400) == 0) {return true;}
else if ((aYear % 100) == 0) {return false;}
else if ((aYear % 4) == 0) {return true;}
else {return false;}
}
}
- 05-07-2008, 08:24 AM #2
- 05-07-2008, 08:30 AM #3
I did but no joy yet
- 05-07-2008, 08:37 AM #4
Similar Threads
-
Non-Static method in static context error
By wizmang in forum New To JavaReplies: 4Last Post: 04-24-2008, 08:51 AM -
Call a Method Automatically
By rhm54 in forum New To JavaReplies: 4Last Post: 02-07-2008, 08:51 AM -
Private main method
By bugger in forum New To JavaReplies: 1Last Post: 12-21-2007, 09:45 AM -
Unablt to call a sessionbean's business method in EJB 3.0
By amitid4forum in forum Enterprise JavaBeans (EJB)Replies: 0Last Post: 11-24-2007, 12:00 PM -
Error: Non-static method append(char) cannot be referenced from a static context
By paul in forum Advanced JavaReplies: 1Last Post: 08-07-2007, 05:05 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks