Monday, September 23, 2013

static methods question

Static methods executes at compile time then it executes before the object construction (as they get constructed during run time). But in our main method we create a class object and invoke class methods right . How does this happen when the method execution is happening at compile time it should throw an exception for object construction. Can you explain

public class animal {

public void behaviour() {
System.out.println("I am a dog");


public class Tiger {
public static void main(String[] args) {
Animal ani = new Animal();  // here we are construction animal object which gets created runtime. How come static method gets executed then?                                         ani.behaviour();                                               

sorry this is not related to GWt 

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment