File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes [to - Eric]..inner class 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 "[to - Eric]..inner class" Watch "[to - Eric]..inner class" New topic

[to - Eric]..inner class

chao-long liao
Ranch Hand

Joined: Jul 29, 2001
Posts: 78
Inner classes are real classes, and can be manipulated the same as "top-level" classes,an inner class can implement an interface or extend a class.
//try this code
interface S{}
class Base {}
public class A{
public static void main(String argv[]){}
private class inner extends Base implements S{}
Ashik Uzzaman
Ranch Hand

Joined: Jul 05, 2001
Posts: 2373

Nice liao! The code shows that inner classes can also extend
interfaces like package-level classes...


Ashik Uzzaman
Senior Software Engineer, TubeMogul, Emeryville, CA, USA.
Eric Pramono
Ranch Hand

Joined: Jul 09, 2001
Posts: 74
Thanks Liao..
Really appreciate it..
Regarding my other thread...
I think that anonymous class is the one that cannot extends an explicit class and implements an interface at the same time..
am I right?
- eric
Ashik Uzzaman
Ranch Hand

Joined: Jul 05, 2001
Posts: 2373

U should be right eric!
I agree. Here's the link:
subject: [to - Eric]..inner class
It's not a secret anymore!