[4636] in java-interest
Re: Doubles and Math (<> C)
daemon@ATHENA.MIT.EDU (D'Arcy Smith)
Tue Jan 9 21:30:45 1996
Date: Tue, 09 Jan 1996 17:02:06 -0800
From: "D'Arcy Smith" <darcy@arcs.bcit.bc.ca>
To: java-interest@java.sun.com
Michael Afergan wrote:
> t = new Double(test.getText());
>
> but get the following error:
>
> Calc.java:46: Incompatible type for =. Can't convert java.lang.Double to
> double.
>
> t = new Double(test.getText());
>
> This leads to a basic problem. Should I define my number variables as
> I would in C (i.e., double total, int size) or should I define them with their
> official class names (i.e., java.lang.Double total).
Depends on what you want:
- make t a Double and use 't.doubleValue()' everwhere that
you would have use 't'
- make t a double and write the above like:
t = new Double(test.getText()).doubleValue();
..darcy
--
D'Arcy Smith, Systems Analyst
Applied Research in Computer Systems (ARCS) Laboratory
British Columbia Institute of Technology (BCIT), Burnaby, BC, Canada
E-Mail: darcy@arcs.bcit.bc.ca URL http://www.arcs.bcit.bc.ca
Tel: (604) 432-8281 Fax: (604) 436-1297
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com