File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes are this two statements about INNER class is true? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "are this two statements about INNER class is true?" Watch "are this two statements about INNER class is true?" New topic
Author

are this two statements about INNER class is true?

Hades Pan
Ranch Hand

Joined: Nov 25, 2001
Posts: 106
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

Joined: Jul 20, 2001
Posts: 464
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

Joined: Jul 03, 2001
Posts: 2120
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.


SCJP2. Please Indent your code using UBB Code
Uma Viswanathan
Ranch Hand

Joined: Jun 14, 2001
Posts: 126
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

Joined: Aug 26, 2001
Posts: 7610
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


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
Uma Viswanathan
Ranch Hand

Joined: Jun 14, 2001
Posts: 126
Thanks Valentin. I understood...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: are this two statements about INNER class is true?
 
Similar Threads
SwingUtilities.invokeLater problem
Inner classe
nested inner classes
appliedreasoning #60
Wrong Answer?