can we create a object in static block
class A
{
static {
A a=new A();
}
}
Answer Posted / srinu
Yes we can create a object in static block
EX:-
public class Stobject
{
static
{
Stobject st =new Stobject();
}
Stobject()
{
System .out.println("object created");
}
public static void main(String k[])
{
System .out.println("HAI");
}
}
output:-
object created
HAi
Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
What are controls and what are different types of controls in awt?
What are swings awt?
What is swing used for?
What is the role of java swing?
Why swing is used in java?
What is swing gui?
What is the base class for all swing components?
Is swing thread-safe?
What are the advantages of the event-delegation model over the event-inheritance model?
Is java swing a framework?
What is jpanel swing?
Is java swing still used?
What is difference between jframe and swing?
What is the difference between swing and awt?
What are heavy weight components ?