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
Why swings are used in java?
Why does JComponent have add() and remove() methods but Component does not?
Which package is needed for swing components?
What is swing control in java?
When we should go for codebase in applet?
What are the components of swing?
What is the difference between swing and awt?
Which window contains the swing controls?
Explain the difference between swing and jsf.
Why are swing components called lightweight?
What is java panel swing?
What is the function of abstractaction class?
Is swing still used in java?
Why should the implementation of any swing callback (like a listener) execute quickly?
What is frame in java swing?