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?

Answers were Sorted based on User's Feedback



what is inner class?..

Answer / ranganathkini

An inner class is a class that is defined within the
definition of another class but outside any member
definition. Inner classes shud not be marked static.

An Inner class cannot be instantiated directly, i.e. one can
only instantiate an inner class by first instantiating the
outer class.

The Inner class has access to all the static as well as
non-static public/protected/private fields of its enclosing
outer class.

Inner classes are used to provide implementation that are
intimately connected with the enclosing outer class.

Is This Answer Correct ?    39 Yes 7 No

what is inner class?..

Answer / varsha vilas kalebag

inner classes has right to excess members of outer classes

Is This Answer Correct ?    11 Yes 1 No

what is inner class?..

Answer / amit kumar

A class within another class is known as nested class. There
are two type of nested class static nested class and non
static nested class.The static nested class did'nt access
its enclosed member function directly, where an non static
nested class can directly access. the non static nested
class is known as inner class. There are 4 type of nestated
class they are Nested top-level classes, Member classes,
Local classes, Anonymous classes....

Is This Answer Correct ?    7 Yes 1 No

what is inner class?..

Answer / 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

what is inner class?..

Answer / harish

Inner classes nest within other classes. A normal class is
a direct member of a package, a top-level class. Inner
classes, which became available with Java 1.1, come in four
flavors:
? Static member classes
? Member classes
? Local classes
? Anonymous classes
Let's take a quick look at each in turn.
Briefly, a static member class is a static member of a
class. Like any other static method, a static member class
has access to all static methods of the parent, or top-
level, class.
Like a static member class, a member class is also defined
as a member of a class. Unlike the static variety, the
member class is instance specific and has access to any and
all methods and members, even the parent's this reference.
Local classes are declared within a block of code and are
visible only within that block, just as any other method
variable.
Finally, an anonymous class is a local class that has no
name.

Is This Answer Correct ?    6 Yes 6 No

what is inner class?..

Answer / shahid

there is one "locha" in paragraph one of answer number 1.

since local classes are also inner classes which are defined within any block and that block can be a method's body.

class OuterSpace {
private String MessageComming = "is any body there";

void receiveMessage() { //outer c;lass method

class InnerSpace { //defining class in outter class method
public void receivingMessage() {

System.out.println("message send by eline is" +MessageComming);
}
}
}
}

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More Core Java Interview Questions

when a request is generated from apache tomcat 5.5 and goes to oracle 10g or mysql,,, how the oracle or mysql reads the request as apache is a web server and oracle 10g is application server? when the oracle 10g provides response, how the apche tomcat reads it???

0 Answers   SAP Labs,


Is string a keyword in java?

1 Answers  


What are the main features of java?

0 Answers  


I have an HashMap object, which has with key and value pair. It has 10 keys and values in that object. Now the question is I want insert new key and value in middle or any where in that list but not at the end or at the top. Is it possible or not. If yes how can we achieve this one?

2 Answers   Huawei,


Name container classes in java programming?

0 Answers  


What is a local block?

0 Answers   Global Logic,


explain the life cycle of thread?

10 Answers   CTS, NIIT, TCS,


Explain different ways of creating a thread?

0 Answers  


What is double checked locking in singleton?

0 Answers  


What is treeset in java?

0 Answers  


Difference between static and dynamic class loading.

0 Answers  


What is hashset in java?

0 Answers  


Categories