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);
     }
    }
  • 相关阅读:
    boboJavaScript中innerHTML,innerText,value
    bobo JS中document.write(" ");
    bobo window.location.href
    bobojQuery选择器总结
    bobo jquery attr()方法
    bobowindow.location.hash 属性使用说明
    bobo$(function(){})和$(document).ready(function(){})
    bobo使用jQuery解析JSON数据
    MyBatis实现CRUD操作
    第一个MyBatis程序
  • 原文地址:https://www.cnblogs.com/rong123/p/9894351.html
Copyright © 2011-2022 走看看