Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8391459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:16:04+00:00 2026-06-09T19:16:04+00:00

I created a class with name Object in a package java.lang . In some

  • 0

I created a class with name Object in a package java.lang. In some another package I created Main class. Now in main method of Main class when I write new Main() and put a dot after that I don’t see equals(), wait() etc.. i.e methods of actual Object class.

My question is don’t you think creating an class with name Object(specially with java.lang package) should not be allowed. As Object class is by default inherited by all classes so in my case whatever class I define will automatically inherit my class instead of actual object class because class name and package name of my object class is same as that of actual object class.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T19:16:06+00:00Added an answer on June 9, 2026 at 7:16 pm

    This is quite an open-ended question.

    Should it be allowed? Why not, if you know what you’re doing, go crazy.

    I agree it’s somewhat dangerous theoretically, but I don’t see how someone would do this by mistake. If someone actually wants to redefine the whole Object class for some reason, academical for instance, then he/she can do so at his/her own risk.

    No language can fully prevent you from putting an arrow to your own knee.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a jar-file with a compiled Java class. Now I want to
Using Groovy's package name convention, I can intercept Groovy method calls to a Java
Example 1 /** *Program Name: Cis36L0411.java *Discussion: Class -- Data Members ONLY * Method
I want to create an object, let's say a Pie. class Pie def initialize(name,
I created a class in C++ called Commands (file name commands.cpp). I've taken that
I have created the following class class Contact def initialize(id, name, phone) @id =
Say I have a structure like: class SomeObject Public Name as String Public Created
I am created class diagram in asp.net mvc. I drag and droped some of
I'm new to Java and I have to create a value object, (maybe it's
i am trying to gt a list of method on a particular java class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.