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

what is inner class?

Answer Posted / midhun h kumar

Inner classes-> Nested top-level classes, Member classes,
Local classes, Anonymous classes

Nested top-level classes- If you declare a class within a
class and specify the static modifier, the compiler treats
the class just like any other top-level class.
Any class outside the declaring class accesses the nested
class with the declaring class name acting similarly to a
package. eg, outer.inner. Top-level inner classes implicitly
have access only to static variables.There can also be inner
interfaces. All of these are of the nested top-level variety.

Member classes - Member inner classes are just like other
member methods and member variables and access to the member
class is restricted, just like methods and variables. This
means a public member class acts similarly to a nested
top-level class. The primary difference between member
classes and nested top-level classes is that member classes
have access to the specific instance of the enclosing class.

Local classes - Local classes are like local variables,
specific to a block of code. Their visibility is only within
the block of their declaration. In order for the class to be
useful beyond the declaration block, it would need to
implement a
more publicly available interface.Because local classes are
not members, the modifiers public, protected, private, and
static are not usable.

Anonymous classes - Anonymous inner classes extend local
inner classes one level further. As anonymous classes have
no name, you cannot provide a constructor.

Is This Answer Correct ?    6 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of optional ?

1022


Can you inherit a constructor java?

1056


How many bytes is double?

956


Explain the difference between an Interface and an Abstract class?

1159


What is the difference between state-based unit testing and interaction-based unit testing?

924


What do you understand by the term singleton?

978


How do I convert a numeric ip address like 192.18.97.39 into a hostname like java.sun.com?

999


Can we have two main methods in a java class?

1033


What are the three best choices for a development environment?

1097


What is Java Shutdown Hook?

1175


Is java ee a framework?

965


whar are the draw backs of programming lang step by step in Clang and next in C++ and next and in Java nad in .Net

2084


What is the purpose of using the java bean?

1035


when you will synchronize a piece of your code? : Java thread

1001


What is the lifetime and scope of a variable?

988