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
Is swing still used in java?
Why swing components are called lightweight components?
Which package is needed for swing components?
What is actionlistener in java swing?
What is the use of jcomponent class in swing?
What is Java Swing?
Explain how to render an html page using only swing.
What are the advantages of java swing over angular?
What is swing and awt in java?
What is the use of jfc in java swing?
What is java swing package?
Can a class be it?s own event handler? Explain how to implement this?
What is the difference between a scrollbar and a jscrollpane ?
What is swing control?
How to create a swing gui in java?