Java float浮点运算

2019年2月11日21:32:22 发表评论 914 views
/**
 * Created by xabcd on 2019/2/11.
 */
public class float1_1
{public static void main(String args[])
{
    float num = 3.0f;//此处一定要加f
    System.out.println(num+"*"+num+"="+(num*num));
    //浮点和整数或者浮点乘除依然是浮点


}
}





3.0*3.0=9.0

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: