answersLogoWhite

0


Best Answer

An inner class should be for private use. Only the outer class should have access and to create an instance of it.

In the following example, as the question stated, the creation a Inner2, should be done by Inner1:

class Outer {

class Inner1 {

class Inner2 {....}

}

}

However, if Outer need to access to Inner2 via Inner1, there is something wrong with the design. The Outer class should NOT have any knowledge of Inner2.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you create objects for inner class inside an another inner class?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

In java difference between classes and object in tabluar form?

A class is a template to create objects. You define the general behavior of a new data type in a class; then you create objects as specific variables of the new type. In other words, you can consider the class as a data type.A class is a template to create objects. You define the general behavior of a new data type in a class; then you create objects as specific variables of the new type. In other words, you can consider the class as a data type.A class is a template to create objects. You define the general behavior of a new data type in a class; then you create objects as specific variables of the new type. In other words, you can consider the class as a data type.A class is a template to create objects. You define the general behavior of a new data type in a class; then you create objects as specific variables of the new type. In other words, you can consider the class as a data type.


What is class?

It is where you leave school or otherwise find a way to avoid going to that particular class.


What is meant by instancing a class?

The class can be considered a template to create objects. When you create an object, you create it on the basis of the specified class - the object is an instance of the class, and the act of creating the object is also known as "instantiating" the class.


What is the difference between class variables and instance variables?

In the case of an instance variable, there is one copy for every instance (object). If you create 10 objects based on a class, there will be 10 copies of the variable. A class variable exists only once for the entire class - no matter how many objects you create - or even if you create no objects based on the class. In Java, such variables (class variables) are declared with the statickeyword.


Interface can be defined inside another class?

yes ,interface can be defined inside another class


Can a class write inside an interface?

Yes, you can create a static class inside an interface, but it is normally not a good idea.


What conditions a function must specify in order to create objects of a class?

The object must have same name as that of class name.


What condition a function must specify in order to create objects of a class?

The object must have same name as that of class name.


What is the simply meaning of object oriented?

The short explanation is that it is computer programming that involves classes and objects. A class is a template to create objects; it can also be considered as a data type. Classes allow you to create new data types; for example, you could create a class to handle dates, points in 3D space, etc. Functions, instead of being independent, are associated with a class (and therefore with objects based on the class); such functions are known as "methods". The objects, of course, also need to store data; variables at the class/object level are known as "fields".


How do you write classes and objects for hospital management software using objective c or c plus plus?

You declare a class as follows: class MyClass { //some stuff here... } You create an object as follows: MyClass object; This is how you create classes and objects in C++.


How can you use some features of a class without inheritance?

You can create a class that does not inherit from anything and nothing inherits from it. You can then create objects from that class. This allows you to encapsulate and abstract data and methods into a simple interface to be used elsewhere in your program.


Could array may have elements that are numbers and strings?

In Java:Not as primitives; but I believe you could create an array of Objects, and then initialize the elemnets as subtypes of the Object class, i.e., any class. I don't think this would be very practical (in Java); if (for example) you need to store information about people's names with their ages, create a class called "Person" that has those two attributes, then create an array of Persons.In Java:Not as primitives; but I believe you could create an array of Objects, and then initialize the elemnets as subtypes of the Object class, i.e., any class. I don't think this would be very practical (in Java); if (for example) you need to store information about people's names with their ages, create a class called "Person" that has those two attributes, then create an array of Persons.In Java:Not as primitives; but I believe you could create an array of Objects, and then initialize the elemnets as subtypes of the Object class, i.e., any class. I don't think this would be very practical (in Java); if (for example) you need to store information about people's names with their ages, create a class called "Person" that has those two attributes, then create an array of Persons.In Java:Not as primitives; but I believe you could create an array of Objects, and then initialize the elemnets as subtypes of the Object class, i.e., any class. I don't think this would be very practical (in Java); if (for example) you need to store information about people's names with their ages, create a class called "Person" that has those two attributes, then create an array of Persons.