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 the difference between swing and awt in java?

935


What is import javax swing in java?

911


Why should the implementation of any swing callback (like a listener) execute quickly?

952


What is an event in Swing?

1000


Is swing part of core java?

955


What are heavy weight components ?

991


What is the what is the difference between invokeandwait() and invokelater()? ?

1036


What is the design pattern that java uses for all swing components ?

867


Why swing is used in java?

948


How to link two forms in java swing?

1101


What is swing gui?

879


What is jfc? What are the features of jfc?

985


What is the difference between swing and awt?

913


How does accessibility works in swings?

909


What is a swing day?

998