title: The method clone() from object is not visible?
body: <p>Question:</p>
  
  <pre><code>package GoodQuestions;
  public class MyClass {  
      MyClass() throws CloneNotSupportedException {
          try {
              throw new CloneNotSupportedException();
          } catch(Exception e) {
              e.printStackTrace();
          }
      }   
  
      public static void main(String[] args) {    
          try {
              MyClass  obj = new MyClass();
              MyClass obj3 = (MyClass)obj.clone();            
          } catch (CloneNotSupportedException e) {
              e.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p>Here class 'MyClass' can able to clone its own object by calling the clone method in 'Object' class.
  When I try to clone the of this class('MyClass') in another class('TestSingleTon') in the same package 'GoodQuestions' it is throwing the following compile time error.</p>
  
  <p><strong><em>'The method clone() from the type Object is not visible</em></strong>'</p>
  
  <p>So here is the code it throwing the above error?</p>
  
  <pre><code>package GoodQuestions;
  public class TestSingleTon {
      public static void main(String[] args) {
          MyClass  obj = new MyClass();
          MyClass obj3 = obj.clone(); ---&gt; here is the compile error.
      }
  }
  </code></pre>