• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

are this two statements about INNER class is true?

 
Hades Pan
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1 Non-static inner classes (which are not defined in a method) have access to all class and instance variables, regardless of the access qualifier of those variables.
2 An inner class can actually be a subclass of the outer class
 
Ragu Sivaraman
Ranch Hand
Posts: 464
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Hades Pan:
1 Non-static inner classes (which are not defined in a method) have access to all class and instance variables, regardless of the access qualifier of those variables.
2 An inner class can actually be a subclass of the outer class

TRUE
TRUE
 
Jose Botella
Ranch Hand
Posts: 2120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Though 2 is not recommended. Because adding an inner class is a way of adding funcionality to a class. In fact, it is like a kind of multiple inheritance. So why adding exactly the same behaviour as the outer class portraits?
Apart from that I think the compiler has problems with this kind of inner classes.
 
Uma Viswanathan
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An inner class can actually be a subclass of the outer class - False.
If a class is a subclass of super class, then it can not be inner class of the super class.
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Uma,
I think you should try to code what you claim:

compiles perfectly well... I'd like to know how you came to your point ?

------------------
Valentin Crettaz
Sun Certified Programmer for Java 2 Platform
 
Uma Viswanathan
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Valentin. I understood...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic