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 object for static class in java

Answer Posted / santosh vyavhare

We can create a object of "static nested class ".
For eg. class Abc{
static class X{
void m()
System.out.println("static nested class method");
}
public static void main(String[] a)
{
X x=new X();
x.m();
}
}


but if you can not declare outer class as a static if u try to make outer class as static it will generate compile time error.
For eg static class X{}
It will generate compile time error as "Illegal modifier for the class".

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you replace all in word?

1068


What is jit compiler in java?

1108


What is the console in java?

1160


Why java is made?

978


I want to re-reach and use an object once it has been garbage collected. Define how it’s possible?

1016


What is core java used for?

1125


What are the common uses of "this" keyword in java ?

1024


What is the collections api in java programming?

980


What is the use of inner class?

1046


What are the differences between string and stringbuffer?

1125


How will you initialize an Applet?

1151


How can a gui component handle its own events?

1114


How to declare an arraylist in java?

1116


What is the difference between a window and a frame in java programming?

1139


Why parameters should be passed by reference?

972