abhinas raj wrote:it was an interview question. so answer should be like we can not call more than once ?
The answer is exactly what I already stated (subject to Winston's correction that we don't actually call it ourselves anyway). This sounds like one of those questions where the interviewer thinks he's being "clever," so nobody here knows what answer he was actually looking for.
Rather than trying to memorize the answers to every possible interview question, you'll do a lot better if you just actually learn the fundamentals of Java.
When is a class loaded in the JVM? When we compile it or when we actually run it?
I write some Java code. I compile it to .class files and put them into a .jar. A week later I post that jar file on the web, from my house here in California, and maybe the server is in New York. Another week after that, you buy a brand new computer, and once you get it set up, you download my jar file to your computer in India. You start up a JVM and execute my jar file.
Do you think my class got loaded into your JVM in India when I compiled it in California, 2 weeks before you got your computer?
Or do you think it got loaded into your JVM when you ran the JVM and told it to execute my jar?