Results 1 to 4 of 4
- 05-11-2013, 06:14 PM #1
Member
- Join Date
- Feb 2013
- Posts
- 15
- Rep Power
- 0
Cloneable/cannot find symbol question
Hi,
I have a question about an error message I'm getting. Here is my code:
Java Code:class Base implements Cloneable { public void clone(Base base) throws CloneNotSupportedException { new Base().clone(); clone(); } } public class TestProtected { public static void main(String[] args) { new Base().clone(); // compilation error: symbol not found } }
When I remove the clone method in Base, then I get the expected protected access error.
Thank you.
- 05-13-2013, 11:31 AM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 13,541
- Rep Power
- 25
Re: Cloneable/cannot find symbol question
Your clone method takes a Base parameter.
The proper clone() method takes no parameters.Please do not ask for code as refusal often offends.
** This space for rent **
- 05-13-2013, 10:06 PM #3
Member
- Join Date
- Feb 2013
- Posts
- 15
- Rep Power
- 0
Re: Cloneable/cannot find symbol question
I understand but the clone(Base) is overloading the clone method correct? So my Base class should have two clone methods one that takes Base and the one inherited from Object. Why can't I attempt to call the clone method inherited from Object which takes no parameters?
- 05-14-2013, 04:14 AM #4
Similar Threads
-
cannot find symbol
By vastrolorde in forum New To JavaReplies: 11Last Post: 01-04-2013, 11:11 AM -
Cannot find symbol errors question
By zlloyd1 in forum New To JavaReplies: 1Last Post: 12-17-2012, 03:24 PM -
cannot find symbol
By GabWit in forum New To JavaReplies: 3Last Post: 01-25-2009, 12:13 AM -
cannot find symbol symbol :constructor Error. Please help! =(
By KalEl in forum New To JavaReplies: 9Last Post: 10-18-2008, 08:26 PM -
cannot find symbol symbol : class Item location: package platypos.services.order
By officialhopsof in forum New To JavaReplies: 3Last Post: 05-01-2008, 08:30 AM
Bookmarks