4000-520-616
欢迎来到免疫在线!(蚂蚁淘生物旗下平台)  请登录 |  免费注册 |  询价篮
主营:原厂直采,平行进口,授权代理(蚂蚁淘为您服务)
咨询热线电话
4000-520-616
当前位置: 首页 > 新闻动态 >
热卖商品
新闻详情
Integer和int的区别?在什么时候用Integer和什么时候用i..._CSDN博客
来自 : CSDN技术社区 发布时间:2021-03-24
package java基础题目;    /**  * 问题 要想表达出没有参加考试和考试成绩为0的区别 我们应该用Integer表示还是用int表示   */  public class A2015年6月4日_Integer和int {      private static int score;      private static Integer score2;  //  private static boolean ss;      public static void main(String[] args) {            System.out.println( int类型的默认值score2:    score);// 0            System.out.println( Integer类型的默认值score:    score2);// null            /*          * if(score null){//报错因为score是int类型的不能和null比较          *           * }          */  //      if(ss true)  //      score2            if (score2   null) {              System.out.println( 没有参加考试!!! );          } else if (score2   0) {              System.out.println( 考试成绩为0分 );          } else {              System.out.println( 考试成绩为    score2);          }                    integer();      }        public static void integer() {          String string    12345 ;          Integer i   Integer.parseInt(string);// 把字符串解析为Integer类型          Integer max   Integer.MAX_VALUE;          Integer min   Integer.MIN_VALUE;          System.out.println( Integer.parseInt(string)    i);          System.out.println( integer的最大值 max ,最小值 min);      }  }
2018年4月12日* int是java提供的8种原始数据类型之一。Java为每个原始类型提供了封装类,Integer是java为int提供的封装类。int的默认值为0, *而Integer的默认值为nul...integer/* * int是java提供的8种原始数据类型之一。Java为每个原始类型提供了封装类,Integer是java为int提供的封装类。int的默认值为0, * 而Integer的默认值为null * ,即Integer可以区分出未赋值和值为0的区别,int则无法表达出未赋值的情况,例如,要想表达出没有参加考试和考试成绩为0的区别 * ,则只能使用Integer * 。在JSP开发中,Intege...Integer和int的区别?在什么时候用Integer和什么时候用int

本文链接: http://integer.immuno-online.com/view-704117.html

发布于 : 2021-03-24 阅读(0)
公司介绍
品牌分类
联络我们
服务热线:4000-520-616
(限工作日9:00-18:00)
QQ :1570468124
手机:18915418616
官网:http://