如何使两个INT的除法产生一个浮点数而不是另一个INT?
v = s / t
class CalcV { float v; float calcV(int s, int t) { v = s / t; return v; } //end calcV}public class PassObject { public static void main (String[] args ) { int distance; distance = 4; int t; t = 3; float outV; CalcV v = new CalcV(); outV = v.calcV(distance, t); System.out.println("velocity : " + outV); } //end main}//end class
跃然一笑
相关分类