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

Explain the pointers in Java?

1004


Why do we need hashmap in java?

1043


What does serializing data mean?

901


What do you understand by the term polymorphism?

1012


What is variable and example?

919


Explain working of call by reference function invoking.

973


What is length in java?

969


What is constructor chaining in java?

1027


Can you pass by reference in java?

944


What are the principle concepts of oops?

917


What are the states of thread in java?

925


Why java is called not pure object oriented language?

979


Can you declare an interface method static?

1015


How is treeset implemented in java?

965


What is the difference between error and an exception?

1072