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
Which package is needed for swing components?
What are the swing components in java?
What is jpanel swing?
What is swing framework in java?
What is java swing used for?
What is swing package in java?
Explain how to render an html page using only swing.
What are the two key features of swing?
What are differences between swing and awt?
What's java swing?
Which method of the Component class is used to set the position and size of a component?
Write a program to paint the off-screen buffer in swings
What is java swing components?
Is java swing still used?
Which swing methods are thread-safe?