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 new bie question-- top-level classess Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "new bie question-- top-level classess" Watch "new bie question-- top-level classess" New topic
Author

new bie question-- top-level classess

RT
Greenhorn

Joined: Oct 19, 2000
Posts: 3
I am preapring for my SCJP exam. I have some good experience in c/c++. I started my prepration with RHE and side by side taking mock exams to my confidence level. I come across the words "top-level classes" and sometimes "top-level classes (not inner class)". Can someone explain what exactly a "top-level" class mean with respect to the package, inner classes, etc..
Thanks
Ramesh
Jane Zheng
Greenhorn

Joined: Oct 17, 2000
Posts: 11
Hi, Ramesh:
Let me try it first. Correct me if I am wrong.
Top-leve classes: they are members of packages.
Nested top-level classes: Inner classes with static modifier.
A local classes: defined in a blocks.
Anonymous classes: combine delcare & creation, have no names.
Jane Z.
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5781
'RT'
PROPER NAMES ARE NOW REQUIRED!!
Read this post for more details.
Ajith


Open Group Certified Master IT Architect.
Sun Certified Architect(SCEA).
Jane Griscti
Ranch Hand

Joined: Aug 30, 2000
Posts: 3141
Just to add to Jane's post, here's a code example

Hope that helps.
------------------
Jane


Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
zulfiqar raza
Ranch Hand

Joined: Oct 18, 2000
Posts: 81
Originally posted by Jane Griscti:
[B]Just to add to Jane's post, here's a code example

[/B]

Jane, are you trying to depict an anonymous class? Is this right?
thanks,
Zulfiqar

Jane Griscti
Ranch Hand

Joined: Aug 30, 2000
Posts: 3141
Hi Zulfiqar,
Yes. I was trying to show that you can create an Anonymous class using any existing class. For example, if you had a class named <code>Attr</code> that had a method <code>public Object setValue(Object nv)</code> you could create an Anonymous class based on <code>Attr</code> by doing something like:

You can call any of the original constructors but you can't redefine a constructor as technically the anonymous class doesn't have a name.

------------------
Jane
 
IntelliJ Java IDE
 
subject: new bie question-- top-level classess
 
Threads others viewed
Interface Question - Can you answer it?
static inner classes
Inner Class definition per JLS
Access modifiers for a class
Inner Classes
IntelliJ Java IDE