File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes What  is difference between Top Level Class and Super Class? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "What  is difference between Top Level Class and Super Class?" Watch "What  is difference between Top Level Class and Super Class?" New topic
Author

What is difference between Top Level Class and Super Class?

Hanuma Deepak Muvvala
Ranch Hand

Joined: Nov 20, 2005
Posts: 158
In the ejb core specifications document in many places for defining rules of a bean they have mentioned 2 points(almost for all beans)

1. The class must be a top level class.

2.The session bean class may have superclasses and/or superinterfaces.

by reading second point I got confused about first point. I dont know what is difference Top Level Class and Super Class.

Can any body explain?

Thanks ............
Deepak.
Balaji Ramalingam
Greenhorn

Joined: Nov 08, 2004
Posts: 9
According to my understanding, top level class will not have any super class.

Where as super class can have another super class.

hope it helps.


Balaji R<br />SCJP 1.4,SCBCD 1.3, SCEA(In Progress)
Vijaya Raghava
Greenhorn

Joined: Jul 30, 2006
Posts: 27

Top-level classes can only have public, abstract, and final modifiers, and it is also possible to not define any class modifiers at all.

private, protected, and static modifiers cannot be used when declaring
top-level classes.

More than one top-level class can be defined in a Java source file, but there can be AT MOST ONE public top-level class declaration.

Most importantly a TOP LEVEL CLASS' NAME MUST MATCH WITH THE FILE NAME. OTHERWISE THE COMPILER WILL COMPLAIN ABOUT THE SAME.

Now you can understand what is a super class....

Regards,
Vijaya Raghava
Hanuma Deepak Muvvala
Ranch Hand

Joined: Nov 20, 2005
Posts: 158
Hi,
Thank you all, now I am clear Top level class is non inner class and super class is a normal super class...

Thanks,
Deepak.....
 
GeeCON Prague 2014
 
subject: What is difference between Top Level Class and Super Class?