zoukankan      html  css  js  c++  java
  • IntegerDemo1

    package cn.it;
    /*
     * 为了对基本类型进行更多的操作,更方便的操作Java就针对每一种基本数据类型提供了
     * 对应的类类型————包装类类型
     * 基本类型                         引用类型
     * byte     Byte
     * short    Short
     * int     Integer
     * long     Long
     * float    Float
     * double    Double
     * char     Character
     * boolean    Boolean
     *
     * 常用:用于基本数据类型与字符串之间的转换
     *
     *                 int类型和String类型的相互转换
     *
     */
    public class IntegerDemo1 {
     public static void main(String[] args) {
      // int---string                          String.valueOf(number)
      int number = 100;
      // 方式1
      String s1 = "" + number;
      System.out.println("s1:" + s1);
      // 方式2 string的valueOf方法
      String s2 = String.valueOf(number);
      System.out.println("s2:" + s2);
      // 方式3
      Integer i = new Integer(number);
      String s3 = i.toString();
      System.out.println("s3:" + s3);
      // 方式4
      String s4 = Integer.toString(number);
      System.out.println("s4:" + s4);
      
      // string---int                        Integer.parseInt(s);
      String s="100";
      int x=Integer.parseInt(s);
      System.out.println("X:"+x);
     }
    }
  • 相关阅读:
    GCC编绎详解
    GUN C/C++ __attribute__ 用法 转
    rust 参考的资料 转
    Eclipse环境安装rust
    GNU Debugger for Windows----GDB
    minGW cygwin gnuwin32
    tdm-gcc
    GNU tools
    The MinGW and mingw-w64 projects.----GCC
    crosstool-NG
  • 原文地址:https://www.cnblogs.com/rong123/p/9894351.html
Copyright © 2011-2022 走看看