Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

can we create a object in static block
class A
{
static {
A a=new A();
}
}

Answer Posted / karthik

We can create object because static block is a executable
block and we don't want any Instance to call. It will be
called before executing or calling the main thread
But here we will get object and exception
//Exception in thread "main" java.lang.NoSuchMethodError:
main

Is This Answer Correct ?    6 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is awt and swing in java?

1025


What is the purpose of transferhandler class?

1118


What are the advantages of swing?

999


Who created the swing?

980


What is actionlistener in java swing?

1088


Explain the difference between awt and swt.

1083


What is import javax swing * used for?

1031


What are the components of swing in java?

1025


What is java swing package?

1006


What is pane in swing?

994


Is swing better than awt?

1131


In what context should the value of swing components be updated directly?

986


How to perform action on button in java swing?

996


What is swing used for?

996


What is the process of setting the layout manager?

1104