Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Java Basics
|
Java Basics General beginning Java language questions that don't fit in one of the more specific forums. Please specify what version.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 9th, 2007, 09:13 AM
Registered User
 
Join Date: Dec 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Question about the clone() method

The java.lang.Object class is the superclass of all classes, this means that all classes are subclasses of this and inherit all it's methods. The clone() method of Object class is protected which means that is inherited to all classes and is accessible from all the subclasses of Object class (that is from all classes anywhere) that are in any package. So why must someone override it in a class, and much more, make it public so as to use it and to inherit it to it's subclasses???. Since it is already protected in Object, it should have been inherited to all classes in any package, because these are subclasses of Object, and protected methods are inherited to all subclasses in any package.

Can someone clarify this, and help me understand it??

Thanks beforehand.

 
Old December 26th, 2007, 05:14 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

go through the following link, you'll get your answer

http://www.artima.com/objectsandjava...ollInner1.html


- Rakesh





Similar Threads
Thread Thread Starter Forum Replies Last Post
Question on RegExp exec() method jackhsu BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 2 June 7th, 2007 01:19 AM
Doubt in clone Method of Object Class pandian Java Basics 1 October 12th, 2006 03:29 PM
SysCmd method question... cjudd VBScript 2 July 22nd, 2005 11:59 AM
Sort Method question rgalehouse Javascript 1 February 10th, 2004 07:03 PM
Question on using the CONFIRM() method savoym Javascript 5 September 11th, 2003 10:34 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.