字符串转化为int

来源:互联网 发布:php打印菱形 编辑:程序博客网 时间:2024/05/17 20:02

 1,

package com.test;

import java.text.ParseException;
import java.util.Date;

public class Test {

 public static void main(String[] args) throws ParseException {
  
  
  Integer i= new Integer("111");
  System.out.println(i.intValue());
 }

}

 

2

package com.test;

import java.text.ParseException;
import java.util.Date;

public class Test {

 public static void main(String[] args) throws ParseException {
  
  System.out.println(Integer.parseInt("111"));
 }

}