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 is layout in java swing?
What is import javax swing jframe?
What is the base class for all swing components?
What is the mean of swing?
What are the benefits of swing over awt?
What is an on stage swing?
How to render an html page using only swing.
How is parsing html used in swing?
What is the role of java swing?
What are the different types of layout managers used in swing?
What is import javax swing * used for?
What are the differences between Swing and AWT?
What is the use of swing in java?
What is the function of abstractaction class?
What are the various components of swing?