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 are the benefits of swing over awt?
What is import javax swing * used for?
Is swing an adjective?
What is the class in swing to change the appearance of the frame in runtime?
How to create a swing gui in java?
What is the design pattern that java uses for all swing components ?
What is swing control in java?
How is parsing html used in swing?
What is swing in java with example?
Write a program to include the internal frame in swing.
How to align components in java swing?
What is jfc? What are the features of jfc?
Which layout does swing use by default?
What are the components of java swing?
What are controls and what are different types of controls in awt?