What does parseInt do exactly?

旧城冷巷雨未停 提交于 2020-01-30 13:29:06

问题


What does parseInt do exactly?


回答1:


A String cannot be used like an int. With parseInt you can convert a string to an int.

public class Program {

public static void main(String[] args) {

String value = "1000";
// Parse with parseInt: the string can be negative.
int result = Integer.parseInt(value);
System.out.println(result);
System.out.println(result + 1);


来源:https://stackoverflow.com/questions/35264666/what-does-parseint-do-exactly

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!