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 awt and swing in java?
What is the purpose of transferhandler class?
What are the advantages of swing?
Who created the swing?
What is actionlistener in java swing?
Explain the difference between awt and swt.
What is import javax swing * used for?
What are the components of swing in java?
What is java swing package?
What is pane in swing?
Is swing better than awt?
In what context should the value of swing components be updated directly?
How to perform action on button in java swing?
What is swing used for?
What is the process of setting the layout manager?