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 the two key features of swing?
Where is java swing used?
Explain the difference between awt and swt.
What are swings?
What is the base class for all swing components?
Why are swings considered lightweight?
What's java swing?
What are swings awt?
How to generate bill in java swing?
What is content pane in swing?
What are swing components?
Hello Everyone.. I m trying to develop a java swing application where i can display a doc file Jeditorpane or Jtextpane.
Why swings are called lightweight components?
What is actionlistener in java swing?
What is the use of java swing?