can we create a object in static block
class A
{
static {
A a=new A();
}
}
Answer Posted / karthik
We can create object because static block is a executable
block and we don't want any Instance to call. It will be
called before executing or calling the main thread
But here we will get object and exception
//Exception in thread "main" java.lang.NoSuchMethodError:
main
Is This Answer Correct ? | 6 Yes | 6 No |
Post New Answer View All Answers
What is java swing package?
What are the advantages of swing over awt?
What are heavy weight components ?
What are the components of java swing?
What is the use of jfc in java swing?
Why swing components are called lightweight components?
What is swing components in java?
What is import javax swing?
What are the two key features of swing?
Is there any heavyweight component in swings?
Is swing still used?
What is swing gui?
What are the advantage of swing over awt?
What is swing framework in java?
What is the use of double buffering in swings?