Home > Java > javaTutorial > body text

How to cast string type to int type in java

王林
Release: 2020-05-13 15:31:28
Original
11465 people have browsed it

How to cast string type to int type in java

The conversion method is as follows:

a="12345";
int i;
Copy after login

(Video tutorial recommendation: java video)

Method one:

i=Integer.parseInt(a);
Copy after login

Method 2:

i=Integer.valueOf(a).intValue();
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template