473,418 Members | 5,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,418 software developers and data experts.

Why does not implement the class URL the method clone()

Hi,

Why does not implement the class java.net.URL the method clone() (and does
not implement the interface clonable)?

Thank you

cu Stephan
Jul 17 '05 #1
1 2749
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stephan Freund wrote:
Hi,

Why does not implement the class java.net.URL the method clone()
(and does not implement the interface clonable)?

Thank you

cu Stephan


Hello,
I would think that since java.net.URL is immutable, there is no reason
to clone it. Just like java.lang.String, if there's no way you can
change the contents of the object, there is no reason you could ever
want a copy made of it (it would be a waste of resources). Instead,
just make a copy of the reference to the same object, since it has
the same practical value in this case.

- --
Chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/JOxZwxczzJRavJYRAp+5AJwMxf1j0mFDZrqUNzxi5AGDCHr5Yg CeM+8N
P2jC83lss1JwFQhyT4vaxLM=
=KJxG
-----END PGP SIGNATURE-----
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: J.J. Feminella | last post by:
(Please disregard the previous message; I accidentally sent it before it was completed.) I have source code similar to the following. public class Vehicle { protected string dataV; // ......
8
by: kurotsuke | last post by:
Hi, I need to clone a class (called NodeAbstract) that I derived from TreeNode. I need to clone it to support drag and drop on the treeview. I tried to use the MemberWiseClone (in my own...
7
by: Don | last post by:
Can anyone give me an example of implementing ICloneable to give a class I created a "Clone" method so I can make copies of objects. I have no idea where to begin with this. Thanks. - Don
1
by: miben | last post by:
I want to create a new inherited class givin its base. For example: class Base { public: void operator =(const Base &base) { // copy base items } }; class Inherits: public Base {
17
by: baibaichen | last post by:
i have written some code to verify how to disable slicing copy according C++ Gotchas item 30 the follow is my class hierarchy, and note that B is abstract class!! class B { public: explicit...
18
by: Sandra-24 | last post by:
Can you create an instance of a subclass using an existing instance of the base class? Such things would be impossible in some languages or very difficult in others. I wonder if this can be done...
18
by: active | last post by:
Console.WriteLine(String.Equals(s, s.Clone.ToString)) s is type string. This returns True. If Clone really made a new copy I'd expect False.
12
by: =?Utf-8?B?RXRoYW4gU3RyYXVzcw==?= | last post by:
Hi, I have a class which "BiologySequence" which looks about like this. public class BiologySequence { private string _Sequence; public string Sequence {
6
by: huohaodian | last post by:
Hi I have some code something like. public class Info { public static IList GetUser() { return User.GetUser();} } internal class User
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.