473,396 Members | 2,061 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,396 software developers and data experts.

extends double?

Is there a way to take an existing
simple type like double and extend it?
I would like to add a few methods without
reimplementing all the rest as calls
to a composed one.

public class doubleR extends double
{
// all existing constructors and methods call double
public toRoman()
{
return String roman = "XXIV"; // translation of double
}
}


----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
Jul 17 '05 #1
5 7753
No

"Mark & Candice White" <mh****@askif.youneedit.net> wrote in message
news:10***********@corp.com...
Is there a way to take an existing
simple type like double and extend it?
I would like to add a few methods without
reimplementing all the rest as calls
to a composed one.

public class doubleR extends double
{
// all existing constructors and methods call double
public toRoman()
{
return String roman = "XXIV"; // translation of double
}
}


----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups ---= East/West-Coast Server Farms - Total Privacy via Encryption =---

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.788 / Virus Database: 533 - Release Date: 11/1/2004
Jul 17 '05 #2
"Mark & Candice White" <mh****@askif.youneedit.net> wrote in message
news:10***********@corp.com...
Is there a way to take an existing
simple type like double and extend it?
I would like to add a few methods without
reimplementing all the rest as calls
to a composed one.

public class doubleR extends double
{
// all existing constructors and methods call double
public toRoman()
{
return String roman = "XXIV"; // translation of double
}
}

First, you'd extend Double, not double. "double" is a primitive type and not
a class which could be extended. Secondly, Double is final, meaning it
cannot be extended. So the short answer to your question is "no". Finally,
please post to comp.lang.java.help in the future. This group is not supposed
to exist.
Jul 17 '05 #3
Hal Rosser wrote:
No

"Mark & Candice White" <mh****@askif.youneedit.net> wrote in message
news:10***********@corp.com...
Is there a way to take an existing
simple type like double and extend it?
I would like to add a few methods without
reimplementing all the rest as calls
to a composed one.

public class doubleR extends double
{
// all existing constructors and methods call double
public toRoman()
{
return String roman = "XXIV"; // translation of double
}
}


----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet


News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000


Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.788 / Virus Database: 533 - Release Date: 11/1/2004

double is a primitive type, look in the API for Double (with capital
letter). This is a so called "wrapper" class of double.
Jul 17 '05 #4
double is a primitive type, look in the API for Double (with capital
letter). This is a so called "wrapper" class of double.


And the answer is still no
Jul 17 '05 #5
> Is there a way to take an existing
simple type like double and extend it?
I would like to add a few methods without
reimplementing all the rest as calls
to a composed one.

public class doubleR extends double
{
// all existing constructors and methods call double
public toRoman()
{
return String roman = "XXIV"; // translation of double
}
}


Hi there,
Based on your example, I'd say you just wanted a different way to
format a double. You should look at Formatters, in the java.text
package. Specifically, DecimalFormat, and see how that works.
John

Jul 17 '05 #6

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

Similar topics

4
by: Phil Powell | last post by:
class Parent { var $errorArray = array(); function Parent() { return true; } function getErrorArray() { return $this->errorArray; }
3
by: Hal Vaughan | last post by:
I'm creating a sequence of JPanels that will each, in turn, be added to (then removed from) a window (kind of like a wizard). I want these panels to not only extend the JPanel class, but to...
0
by: Stacey | last post by:
I hate to start the email with the "I'm new to this clause", but there it is. I am understanding how the xsd files work and how the castor SourceGenerator works. What I am not understanding is...
1
by: Tony Johansson | last post by:
Hello experts! As this program is now it's works perfectly when running as a application or as an Applet. Now to my question if I just change this row "public class Converter extends Applet "...
2
by: cosmo_canuck | last post by:
Hi all! I'm a web designer who's valiantly struggling, with occasional moments of triumph, to build my first fully CSS site. Hope that you can answer a couple of quick newbie questions. Page:...
1
by: iLL | last post by:
In java you can say something like: public class child extends parent { } And child will have all of the parent’s functions. From there you can write new functions and overload parent...
4
by: sandyw | last post by:
I need a little help here with extends. I have three class 1. EventsClass 2. TicketClass I have the extends to EventsClass 3. BuyerClass. I have the extends to EventsClass All three class...
6
by: joxonvdavis | last post by:
I have a topic to discuss.. how can i access a implemeted method of an abstract class if my class exteds that abstract class's sub class? Eg: abstract class A { abstract...
0
by: hockeydave007 | last post by:
I am using jaxb to create my java class and I would like the created class to have additional attributes like: extends java.io.Serializable implements my.com.Interface <xs:complexType...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.