To be specific, I was trying this code:
package hello;
public class Hello
{
Clock clock = new Clock();
public static void main(String args[])
{
clock.sayTime();
}
}
But it gave an error like 'Cannot access non-static field in static method main'. So I changed the declaration of clock to this:
static Clock clock = new Clock();
And it worked. Now my question is, what does it mean to put that keyword before the declaration? What exactly will it do/restrict in terms of what can be done to that object?