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...

why top level class could not be static

Answer Posted / vatsal doshi

The answer is in the question itself.
What is static? Something which belongs to a class and not its objects.

So if in a class, we have some variables, having single copy, we call them static.
Similarly some methods may be actually manipulating these static variables, so those methods are also static.

However, the class itself is static only if it belongs to some class(Definition of static)

So, for a class to be static, it must be a nested class. Such nested classes are called as Top Level Nested Classes in Java.

Is This Answer Correct ?    7 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain java coding standards for methods?

1047


What is default switch case? Give example.

1008


What is Classloader in Java?

1221


how to one war file class to another war file class?

2077


What does g mean in regex?

990


What is a singleton puppy?

986


Do you need to import math in java?

1006


what are abstract functions?

1029


What is null mean in java?

1098


What is mean by encoding?

1082


What if the main() method is declared as private? What happens when the static modifier is removed from the signature of the main() method?

1191


What are the advantages and disadvantages of reference counting in garbage collection?

1029


What is a jit compiler?

1135


How do you read a char in java?

1025


How does hashmap work in java ?

1056