can we create a object in static block
class A
{
static {
A a=new A();
}
}

Answer Posted / naresh tuhania

Yes we can do this . Because we can create an object at
runtime and static block is also execute when a class is
loaded by the class loader at runtime

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the swing components?

686


What is the difference between swing and awt?

715


Where is java swing used?

785


What are heavyweight components? What is lightweight component?

738


Which containers use a border Layout as their default layout in swing?

761


What is the use of java swing?

767


What is java awt and swing?

789


What are the swing components in java?

731


What class is at the top of the AWT event hierarchy?

847


What is the difference between invokeAndWait() and invokeLater()?

787


Who created the swing?

686


What are the advantage of swing over awt?

725


Can a class be it?s own event handler? Explain how to implement this?

728


What is a component in swing?

683


What is java swing gui?

667