Is there a limit to how deep you can go with inner classes?
Like having a class within a class, within a class, within a class, etc....
I'm just curious.
there shouldn't be... if each class allowed x inner classes you've still got a potential of infinity levels deep.
it might make your addressing a bit long winded though o_O
when classes with inner classes or anonymous classes are compiled they tend to occupy a single addressing level with a hash between the "parent" class and the "child" class. so an object of an inner classtype will be of type:
Package/ParentClass#InnerClass rather than type Package/ParentClass/InnerClass
in theory it should be possible to continue that naming convention indefinately, but in practice, the VM or compiler might not be expecting it.. try it out, let me know =P
I think you'll at some point run into limits for the maximum length of classnames (including package names) which are likely Integer.MAX_VALUE.
Before that you'll possibly run into the maximum size of codefiles (though those can be quite large).
The most serious problem of all of course is that it's horrendously bad design to need anything like that ;)
Are you able to help answer this sponsored question?
Questions asked by members who have earned a lot of community kudos are featured in order to give back and encourage quality replies.
i am using visual studio 2015 and trying to export data which i am importing through excel by the user selected Excel file. Now the importing part has been successfully completed i am using OLEDB Connection but Stuck in exporting the same data to a new Excel file. tried ...
I am creating a program that when you print an author, you must show all the information of all the books that the author has written. Add a new attribute in the Author class that will be "BooksWriting: List (Book)".
I have expanded the program so that it also ...
I am currently creating a simulation of a pizza ordering system in object oriented program. I have some question. the instruction and guideline is long but I will try and cut it down a lot. the instruction is to create a program that simulate a pizza restaurant using ...