首页 > 编程语言 >JAVA-Integer_构造方法

JAVA-Integer_构造方法

时间:2022-11-01 21:48:14浏览次数:37  
标签:JAVA 构造方法 System println Integer 100 out

package com.itheima;

public class intger_01 {
    public static void main(String[] args) {

        Integer i1=new Integer(100);//根据int做创建Integer对象(过时)
        Integer i2=new Integer("100");
        System.out.println(i1);
        System.out.println(i2);

        Integer it= Integer.valueOf(100);//返回表示指定Int值的Integer实例
        Integer it2= Integer.valueOf("100");
        System.out.println(it);
        System.out.println(it2);

    }
}

执行结果

100
100
100
100

Process finished with exit code 0

标签:JAVA,构造方法,System,println,Integer,100,out
From: https://www.cnblogs.com/cy-xt/p/16849253.html

相关文章

  • JavaScript笔记 - JS和html代码的结合方式
    JavaScript和html代码的结合方式方式一在head标签或body标签中,使用script标签来书写JavaScript代码<!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF......
  • java中的抽象类abstract
    /***学习抽象类和抽象方法*抽象方法:只进行方法的声明,而不提供具体的实现(没有方法体)*抽象类:只要在一个类中有一个抽象方法,那么这个就得声明一个抽象类*抽象类和......
  • Javascript笔记 - JS中的变量
    变量目录变量1.变量基础2.强制类型转换3.关系运算1.变量基础JS是一门弱类型语言,这意味变量的类型不是固定的,变量可以随时从一种类型转换为另一种类型vari=1;......
  • javascript
    javascript快速入门内部标签<script>alert("helloword!");</script>外部引入<scriptsrc=""></script>基本语法入门数据类型数据、文本、图形、音......
  • Javascript笔记 - JS中的对象
    对象目录对象1.对象的声明与定义2.原型对象3.枚举对象中属性特殊属性值in运算符hasOwnProperty方法for...in语句1.对象的声明与定义显式声明对象并逐个定义属性......
  • javaSE基础-日期时间
    日期时间类日期时间主要类jdk8之前常用的日期时间APISystem静态方法//System类中的currentTimeMillis()@Testpublicvoidtest1(){//返回当前时间与1970年1月......
  • Java Timer源码分析
    通过源码分析,我们可以更深入的了解其底层原理。对于JDK自带的定时器,主要涉及TimerTask类、Timer类、TimerQueue类、TimerThread类,其中TimerQueue和TimerThread类与Timer......
  • JavaScript知识体系(脑图)
    参考书目:《从0到1JavaScript快速上手》(莫振杰著)以下为个人读后参照此书所做,便于今后个人以及对JavaScript感兴趣的小伙伴对JavaScript有一个更系统的认识。......
  • 【Java】重写与重载的区别与例子
    首先需要清楚方法头和方法体的概念,其概念如下:方法头:修饰符+返回类型+方法名(形参列表)+抛出异常类型例如:publicvoidcal(String[]strs,inta)throwsxxException方法体......
  • 【Java】抽象类详解、抽象类与接口的区别
    文章目录​​什么是抽象类​​​​抽象方法的优点​​​​抽象类和接口的主要区别​​什么是抽象类例如:publicabstractclassA{abstractintadd(intx,inty);in......