java program using int and double

前端 未结 7 916
礼貌的吻别
礼貌的吻别 2020-12-21 00:16

I have written a simple Java program as shown here:

public class Test {

    public static void main(String[] args) {
        int i1 =2;
        int i2=5;
           


        
7条回答
  •  清酒与你
    2020-12-21 00:51

    This link provides information about data type conversion, both implicit and explicit type.

    To provide exact answer to the question will be :

    double d = 3 + (double)i1/i2 + 2
    

提交回复
热议问题