jQuery in Action, 3rd edition
The moose likes Beginning Java and the fly likes can we create a class named Object? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "can we create a class named Object?" Watch "can we create a class named Object?" New topic

can we create a class named Object?

senthil sen
Ranch Hand

Joined: Oct 10, 2002
Posts: 184
can we create a class named Object??
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63852

What happened when you tried it?

[Asking smart questions] [About Bear] [Books by Bear]
rob javier

Joined: Oct 20, 2002
Posts: 9
it compiles
Arun Boraiah
Ranch Hand

Joined: Nov 28, 2001
Posts: 233
Yes, you can create class by name Object. But to create the instance of the Object class written by user and use the same. The class should be refered with fully qualified name. i.e If a user writes Object class in a package test, Then refer the Ojbect class as test.Object

Sharing is learning
Sam Smoot
Ranch Hand

Joined: Apr 18, 2002
Posts: 238
That would be a bit confusing, try naming it somthing else... TestObject, for example...

CNSS/NSA Infosec Professional,<br />Software Engineer
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15302

It's not that confusing. And I think it is a good idea to start using packages early on while learning JAVA.
However, Object is a little vague. I would imagine that your Class file encompusses something a little more defined and less general.
IMHO - Keep very descriptive names for your class files. It makes it easier to know what they do at a glance than to have to go into the code every time. Especially if you haven't looked at it in a while.

GenRocket - Experts at Building Test Data
I agree. Here's the link: http://aspose.com/file-tools
subject: can we create a class named Object?
jQuery in Action, 3rd edition