can anyone help me in this.

what is top level class in java?

Recommended Answers

All 12 Replies

read any book.
Object

DaniWeb Member Rules (which you agreed to when you signed up) include:
"Do provide evidence of having done some work yourself if posting questions from school or work assignments"
http://www.daniweb.com/community/rules

Do some research. If you hit something you don't understand after trying a few searches, come back here with your specific question.

i think answer given by stultuske is right..

please mark it solve if you get your answer.

Thanks

the answer is right. Object is the base of everything in Java. but the answer given by JamesCherrill is more important. there is no textbook or course that 'll ever try to teach OO development in Java without mentioning the fact that Object is the base of every other class in Java, and that it's extended by all.
if the OP won't even take the time to figure this one out, it means he never tried reading his book, googling, or anything else, I'm afraid.

Yes, indeed, but the saddest part here is that he's a member of daniweb since January 2011, having 51 posts already. By now, he should have already read at least some programming books, and if not, well...

DaniWeb is not limited to Java. as far as I can tell, he has only 3 posts in the Java section, the rest in the Python section.

Back to the original point:

in Java a "top-level class" is one that is not declared inside another class, ie not a nested class.

Just Google "top-level class" for any number of supporting references such as this.

depending on whether he wanted the explanation for "a" top-level-class, or "the" top-level-class. to show yet again, that being clear in asking a question is very important :)

^ what he just said, yes.

DaniWeb is not limited to Java. as far as I can tell, he has only 3 posts in the Java section, the rest in the Python section.

Not quite what I wanted to point out.

Saddest part:
1.

daniweb since January 2011, having 51 posts already.

which means that he's into programming stuff (i.e. working with computers) for quite some time.
2.

By now, he should have already read at least some programming books

as a flow to your ideea:

if the OP won't even take the time to figure this one out, it means he never tried reading his book, googling, or anything else, I'm afraid.

To the matter at hand: Object. Here is the link from the Java documentation of the Object class.

(Class Object is the root of the class hierarchy. Every class has Object as a superclass. All objects, including arrays, implement the methods of this class.).

Before anyone else creates more distraction with the Object class, the Java Language Specification has 21 references to the term "top level class" and every single one corresponds to the definition right at the top of chapter 8 "Classes"

A top level class is a class that is not a nested class.

Incidentally, not one of those references matches the answer "Object"

So although in general conversation you may refer to Object as being the top (level) class, the JLS reserves that term for one very specific meaning, and it's a brave Java programmer who disagrees with the JLS.

yes and no, pretty sure Object isn't a nested class :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.