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

What is int argc char * argv?

1074


What do you mean by singleton class in java?

863


What is Java Reflection API? Why it’s so important to have?

1085


What is a class object?

931


What loop means?

906


What is a package in java? List down various advantages of packages.

1205


How do you decide when to use arraylist and linkedlist?

948


How would you convert bytes to string?

944


Can you pass functions in java?

952


What is collection sort in java?

907


Is it possible for a yielded thread to get chance for its execution again?

899


What is consumer interface?

956


Can memory leak happen java?

972


Explain the different forms of polymorphism?

958


If two threads have same priority which thread will be executed first ?

1423