笔记之_数据的强制类型转换

1.    数据的强制类型转换
public class DataDemo{
    public static void main(String args[]){
        float f=30.3f;
        int i=(int)f;
        System.out.println(“i=”+i);
        System.out.println("10/3="+(float)10/3);
    }
}
2.    判断多个条件
public class DataDemo2{
        public static void main(String args[]){
        int score=50;
        if((score<0)||(score>100)){
            System.out.println("输入的成绩错误!!");}
        if((score>49)&&(score<60)){
            System.out.println("请准备补考!!");}
    }
}
 

 

posted @ 2017-11-19 16:49  莫轩ASL  阅读(132)  评论(0编辑  收藏  举报