[300] in java-interest
How does one multiply Floats and Integers in Java?
daemon@ATHENA.MIT.EDU (Robert Uomini)
Tue Jun 13 18:05:06 1995
Date: Tue, 13 Jun 1995 14:35:58 -0700
From: uomini@fractals.fractals.com (Robert Uomini)
To: java-interest@java.sun.com
I get a bunch of errors:
... Incompatible type for =. Can't convert int to java.lang.Float.
A = (B*C)/(D*E*100);
^
... Incompatible type for *. Can't convert java.lang.Float to int.
A = (B*C)/(D*E*100);
^
... Incompatible type for *. Can't convert java.lang.Integer to int.
A = (B*C)/(D*E*100);
^
... Incompatible type for *. Can't convert java.lang.Float to int.
A = (B*C)/(D*E*100);
^
... Incompatible type for *. Can't convert java.lang.Integer to int.
A = (B*C)/(D*E*100);
^
When I try to do the following:
Float A;
Float B;
Integer C;
Float D;
Integer E;
A = (B*C)/(D*E*100);
It appears that the compiler is trying to do some kind of intermediate
type conversion; I would expect that it would automatically convert
all Integers to Floats, but it doesn't. Has anyone encountered this
problem? Thanks.
Bob
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com