美文网首页
1.3.2 优先级 & 强制类型转换

1.3.2 优先级 & 强制类型转换

作者: harukou_ou | 来源:发表于2019-02-02 18:12 被阅读2次
    • double -> int
    package test;
    
    import java.util.Scanner;
    
    public class Test1java {
    
        public static void main(String[] args) {
            // TODO Auto-generated method stub
            double foot; //5
            double inch; //7
            Scanner in = new Scanner(System.in);
            
            foot = in.nextInt();
            inch = in.nextDouble();
            //print 170cm
            System.out.println((int)((foot+inch/12)*0.3048*100)+"cm");
        }
    
    }
    
    
    * 优先级与c语言基本相同
    

    相关文章

      网友评论

          本文标题:1.3.2 优先级 & 强制类型转换

          本文链接:https://www.haomeiwen.com/subject/cjzssqtx.html