Home>Article>Java> How to cast string type to int type in java

How to cast string type to int type in java

王林
王林 Original
2020-05-13 15:31:28 11343browse

How to cast string type to int type in java

The conversion method is as follows:

a="12345"; int i;

(Video tutorial recommendation:java video)

Method one:

i=Integer.parseInt(a);

Method 2:

i=Integer.valueOf(a).intValue();

Recommended tutorial:java entry program

The above is the detailed content of How to cast string type to int type in java. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:springmvc workflow Next article:springmvc workflow