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

  • SEARCH
  • Home
  • 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 7749059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:56:45+00:00 2026-06-01T10:56:45+00:00

The Java specification for the java.lang.Cloneable interface defines itself as signifying that any object

  • 0

The Java specification for the java.lang.Cloneable interface defines itself as signifying that any object that extends it also has implemented the clone() method that rests dormant within java.lang.Object. Specifically, it says that:

A class implements the Cloneable interface to indicate to the java.lang.Object#clone() method that it is legal for that method to make a field-for-field copy of instances of that class.

To me, this means that it should be assumed that every class that extends Cloneable therefore also has a public Object clone() method within it. This makes it easy to assume that the following is a valid method:

public static makeACloneFrom(Cloneable c)
{
  return c.clone();
}

however, this is not the case, as the entirety of the Cloneable source code (sans javadoc) is simply

package java.lang;

public interface Cloneable {
}

Which means that Cloneable#clone() does not exist (and trying to compile the example method above throws a compile-time error saying something like “cannot find symbol: method clone()“). Shouldn’t the source code of Cloneable contain something to the effect of public Cloneable clone();?

Why aren’t we allowed to assume that a class that implements Cloneable has a public Cloneable clone() method?

  • 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-01T10:56:46+00:00Added an answer on June 1, 2026 at 10:56 am

    Because it’s a poorly-designed interface.

    From Effective Java (sorry, Google Books does not have a preview for the 2nd edition):

    Item 11: Override clone judiciously

    The Cloneable interface was intended as a mixin interface (Item
    18) for objects to advertise that they permit cloning. Unfortunately,
    it fails to serve this purpose. Its primary flaw is that it lacks a
    clone method, and Object‘s clone method is protected. You
    cannot, with resorting to reflection (Item 53), invoke the clone
    method on an object merely because it implements Cloneable. Even a
    reflective invocation may fail, as there is no guarantee that the
    object has an accessible clone method.

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

Sidebar

Related Questions

For years and years, I've tried to understand the part of Java specification that
The Java EE specification states that an EJB injection like this: @EJB MyInterface myBean;
According to the Java Language Specification : If there are any enclosing try statements
For a university assignment in Java the specification requires that Code Listings: in 10-point
The JPA (Java Persistence API) specification has 2 different ways to specify entity composite
What exactly is the Java Real Time Specification? That is, how does it differ
JAX-RS is a specification that helps you develop restful web services in Java. But
I am looking for alternative specification languages options for Java, like JML. Does any
I am reading Java Virtual Machine Specification second edition for Java 6. But I
When we write java code we use JPA interfaces as its a java specification

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.